Prisoners started fire and attacked guards with pool balls
Two men started blaze after one of them was refused a move to a different cell at Perth prison.
Two prisoners who attacked jail staff and started a fire after one of them was refused a cell move have been sentenced to a further four years.
Ronald Smith asked for a cell transfer at Perth prison but was told no others were available and his request to be moved to the segregation unit was also turned down.
Smith, 31, was heard saying "I'll not be staying another night in that cell" before launching an attack on prison officers with pool balls and an iron.
Convicted killer Kristopher Marshall joined in the assault hurling pool balls at staff, several of whom were struck and bruised.
The pair then started a fire at the pool table in the jail's C Hall which holds inmates on protection.
Other prisoners were evacuated as smoke filled the building before officers in riot gear moved in and removed Smith and Marshall.
Advocate depute Andrew Brown QC told the High Court in Edinburgh: "Given the number of potential casualties major incident procedure was activated and 25 ambulance vehicles were deployed to the prison from all over Scotland.
"An accident and emergency consultant and a nurse were brought in from Dundee's Ninewells hospital to assess prisoners along with the jail's medical staff."
"Only one inmate required hospital treatment for smoke inhalation."
The court heard that the incident had cost the taxpayer nearly £40,000 because of ambulance, fire, police and prison service costs.
A judge told the pair: "You have both pled guilty while acting together to assault of prison officer and wilful fireraising."
Lady Scott pointed out that the incident had been started by Smith's reaction to being told he could not move cells and that Marshall had taken the opportunity for violence and rushed to join in even although it nothing to do with him.
She said the fireraising at the jail had placed fellow prisoners, prison staff and attending firefighters in danger.
The judge told them that she would have jailed them for six years each, but for their guilty pleas.
Smith and Marshall, 32, admitted assaulting officers Colin Young, Grant Hamilton, Jeremy Baker, Stuart Kerr, Robert Howkins and Mark Guthrie by throwing pool balls at them through the bars of security gates at C Hall on May 3 this year.
They also admitted setting fire to combustible materials at the hall resulting in it filling with smoke and causing damage.
Both men were given four-year sentences to run consecutively to their current jail terms.
Solicitor advocate Brian Fitzpatrick, who was representing Marshall, said he would have been due for release on licence within months.
Marshall was jailed for ten years in 2009 for culpable homicide. He said he was not considering the consequences of what he was doing when he took part in the incident and regretted it