Six armed inmates who held a warden and guards hostage in a failed bid to escape a prison in southern Taiwan committed suicide early Thursday and all the hostages are free, a top justice official said.

The Justice Ministry said authorities had rejected the inmates' demands for safe exit from the prison during the hours-long standoff after the inmates seized weapons. By the pre-dawn hours, the inmates had released all hostages except the warden. They then shot themselves, and the warden was able to walk free, Deputy Justice Minister Chen Ming-tang said in a televised interview.

The ministry did not offer any video or other evidence of the reported suicides, but authorities were planning a news conference later Thursday.

Chen said in the interview that "there was no police raid." He said four of the inmates shot themselves first and that the remaining two had fired additional shots at them to make sure they were dead before shooting themselves.

Five prison staffers were slightly injured during the standoff, Chen said.

The incident started when the inmates -- serving long sentences for burglary, murder and drug crimes -- took four rifles, six handguns and more than 200 bullets from the prison's armory, the ministry said.

The ringleader, Cheng Li-te, belonged to the notorious mafia-type organization Bamboo Union and was serving a 28 1/2-year sentence for homicide, the ministry said. The other five inmates were serving sentences ranging from 25 years to life.

They demanded safe passage from the prison while holding Warden Chen Shih-chih and head guard Wang Shih-tsang after the pair offered to swap themselves for earlier hostages.

No injuries had been reported prior to the reported suicides in a standoff that lasted more than six hours, the ministry said.

Witnesses interviewed by private cable news station TVBS said gunshots were heard. Other reports said the shots were fired into the air.

Within hours of the hostage taking, armed police had surrounded the prison in the port city of Kaohsiung. Authorities also called on relatives of the inmates to plea for the release of the hostages.

The ministry said it had rejected demands that the police force be withdrawn and that two vehicles be provided to allow the prisoners to leave in exchange for the safety of the detainees.

The inmates used the need for medical care as a pretense to lure prison guards before kidnapping them, the official Central News Agency said.

The United Daily News said that in a phone call with Cheng he said the incident had been long planned and that he was prepared to die for it. The newspaper said Cheng complained about the tendency of judges to presume guilt, insufficient allowances for inmates and unfairness in granting medical paroles.

The ministry said Deputy Warden Lai Chen-jung and head guard Wang volunteered to swap with the two guards who were initially taken hostage. Later, Chen, the prison warden, offered to exchange with Lai as a hostage.