Scottish Office officials said that the officer, Frank Hargreaves, 28, was unharmed after his ordeal at Perth prison, the scene of five hostage incidents since 1987, and that 'prison officers were now back in control'.
Two negotiatiors - a Glasgow solicitor and the prison chaplain - are believed to have played an important role in bringing the incident to an end.
Shortly before 5pm yesterday 13 of the 60 prisoners controlling D Hall, where the siege took place, gave themselves up. The remainder came out soon after.
The apparently peaceful conclusion of the incident will be seen as vindication of the prison authorities' tactics of establishing contact with the rioting prisoners and adopting a softly, softly, approach to persuading inmates to end their protest.
The siege had begun on Sunday at about 4pm after lock-up time following the prisoners' tea. In one of the four main halls of the Tayside jail, Scotland's oldest, about 60 prisoners took control of D Hall. Sixty other inmates on that wing were taken out and transported to other Scottish prisons. In the ensuing riot, Mr Hargreaves was taken hostage.
Later, two injured prisoners were taken to Perth Royal Infirmary, where one was treated for multiple stab wounds to his face and body.
The jail, on the outskirts of Perth, has records going back to the time it housed French prisoners of war during the Napoleonic Wars. It now holds a mixture of long-term, short-term, and local remand prisoners. It is designated to hold 429 prisoners, but on Sunday it was detaining 440 inmates.
Last night, as officers retook control of the jail, no reason was given for the cause of the siege, which left most of the windows of D Hall smashed and is believed to have caused extensive damage inside the prison.