Six inmates who seized weapons and took staff hostage at a jail in Kaohsiung, Taiwan have killed themselves after a 14-hour stand-off, say justice ministry officials.
The inmates had all been convicted of murder, drug-related offences, burglary and a range of other crimes.
They were protesting against their sentences, alleged mistreatment and unfair trials, Taiwanese media report.
Police surrounded the prison, but the hostages were all unharmed.
The six prisoners had feigned illness to lure two guards and take them hostage at about 16:30 local time on Wednesday (08:30 GMT), Taiwan's Central News Agency reported.
They forced the guards to take them to the prison's weapons cache where they stole four rifles, six handguns and 200 bullets.
Police surrounded the prison, one of the largest in Taiwan, and after negotiations, the prison warden and the head guard were exchanged for the hostages.
But officials rejected the prisoners' request for a getaway car and brought in their relatives and a well-known triad gang leader to talk them into surrendering. The prisoners at one point tried to leave the prison, but were met with police gunfire outside and retreated.
At around 03:00 on Thursday (19:00 GMT Wednesday), the prisoners released the head guard. About two hours after that, the prison warden walked out unharmed, according to CNA .
Deputy Justice Minister Chen Ming-tang said four of the prisoners had killed themselves first. The other two then fired at their bodies, before shooting themselves as well.
Police have not released video or other evidence to support their statement. No other injuries have been reported.
The justice ministry said the ringleader of the group was Cheng Li-te, a member of United Bamboo, one of Taiwan's most powerful Triad organised crime gangs.
Among their complaints were that wages earned for work in the prison were too low - about $6 (£4) a month - so they had to rely on family support, putting relatives in financial difficulty.
In a message delivered by officials, Cheng also complained that former Taiwanese President Chen Shui-bian - jailed for 20 years for money laundering and accepting bribes - had recently been given medical parole.
The BBC's Cindy Sui in Taipei says that Taiwan's prison system has seen 18% more inmates in the past decade as drug offenses and convictions rise. Overcrowding is a serious problem because the government and society do not want to allocate more money to build more prisons.
Security can be lax as prisoners are allowed to do work in the prison's bakeries and other facilities, says our correspondent.
Taiwan's President Ma Ying-jeou has since pledged reform.
"This situation shows that there are holes in the prison administration system... I have asked the justice ministry to put various agencies on high alert, fully stabilise the situation, and do an in-depth review of the prison system," he was quoted as saying on television network TVBS.