Prisoners set alight their cells during riots amid anger over a Covid-19 outbreak at the facility in southern Thailand.
Flames ripped through the building in Krabi province on Friday evening December 17 shortly after 5pm local time.
Prison guards opened fire on convicts with rubber bullets injuring at least 14 of them. Officers later detained 31 of the alleged rioters while firemen brought the inferno under control by 8pm.
The violence came a day after clashes inside the prison that erupted when guards transferred 400 of the 2,100 prisoners to other facilities due to outbreaks of the coronavirus flu.
Prisoners were reportedly angry that those infected with the now-endemic virus were being kept locked up instead of being sent kept in the jail.
The Krabi Pitakpracha Foundation, a volunteer organisation that responded to the blaze, said the worst of the fire was over at 7:30pm.
A spokesman added: ‘Prison guards are securing the building to prevent any more issues.’