I think the movie, which was in color, was set in a remote area of England or Scotland. The prisoner figures out how to escape from his cell. One night he 'goes out', kills someone with an ax, and while returning to his cell passes another man, rubs the blood from the ax on him and stuffs the ax into the other guy's hand before running off. Then he returns to his cell and pretends to be asleep. Part of his escape was based on using a grotesque chess set that he had made. While the guard goes off to get his own set, since he can't stand using the prisoner’s, the prisoner uses wire to hook the door latch so he can open it again after lights out. He is caught because while he's committing the murder a pet bird owned by the victim crawls into his coat pocket. While looking in on the apparently sleeping prisoner, trying to figure out what is going on, the hero see the bird crawl out of the pocket and realizes that - somehow - this guy really did do the murder.
Some parts sound similar to The Night Visitor (1971). It is not a prison, but an insane asylum.