Could it be this?
The Night Visitor (1971)
E.
I'm sure the film stared Max von Sydow although looking at his list of films on IMDb nothing seems to fit. The thread title sums up the plot although I have no idea why the prisoner would want to sneak back to his cell other than to give himself an alibi.
Could it be this?
The Night Visitor (1971)
E.
I would agree that it's The Night Visitor.