On 28 September 1987, 50 prisoners, many of them serving life sentences, seized control of D wing in Peterhead Prison and took two wardens hostage.
One of the guards was freed soon after but 57-year-old Jackie Stuart was held captive for five days without food or water.
During that time he was stabbed, battered and threatened with being burned alive.
Despite his terrifying ordeal, which was brought to an end when SAS troops stormed the cell block with tear gas and sonic grenades, Mr Stuart took just six weeks off work to recover and continued in his job for another couple of years before retiring.
Peterhead Prison opened in 1888 and was able to house around 350 prisoners.
It had a history of poor conditions, with no in-cell toilet facilities and inmates forced to “slop out”.
The prison closed down in 2013, but part of it was reopened as a museum last year.
Now, at the age of 87, the former guard is back on site working as a volunteer tour guide.
He remains stoic about his dramatic experience.
“It wasn’t very nice at the time,” he said.
“We had all sorts of things done to us. I was stabbed, laid on the floor and beaten with table legs.
“I was taken up onto the roof with a chair round my neck. They put cans of petrol in my pockets and they were going to set fire to me.
“It started with one prisoner, a lifer, being placed on report for a minor incident and he decided to stab the officer.
“I went in and got the knife off him but the whole hall had joined in by that time, so I just had to hand it back.”
One of the most terrifying aspects was the uncertainty of the situation. He reckons it was his doggedness that got him through.
“I’m a very thrawn, determined person so I don’t like to get beat,” he said.
“In my mind it was just about surviving because I never knew what they were going to do next, especially the lifer as he was very erratic.”
Alex Geddes, facilities coordinator at the museum, describes Mr Stuart as a true hero.
“He’s in here every week even though he’s officially retired. He’s totally amazing, very down to earth,” he said.
“He’s quiet, unassuming and a real gentleman. And brave, of course.”
The collection of photographs will be on display at Peterhead Prison Museum for the next month, before being returned to the archives.
The museum is also releasing a new book about the 1987 riot, which is due to be published in the next few weeks.