Updated

Security forces on Friday regained control of a crowded prison in western Indonesia where inmates set fires and started a deadly riot that left five people dead and hundreds of prisoners, including convicted terrorists, on the loose, officials said.

About 500 policemen and 300 soldiers were deployed around Tanjung Gusta prison in Medan, the capital of North Sumatra, where the riot broke out Thursday night while fire brigades were battling the fires.

"The situation is fully under control after soldiers managed to enter the prison without resistance," said Akbar Hadi, spokesman for the prison directorate.

Hundreds of other policemen have blocked roads linking Medan to the provinces of Aceh, Jambi and West Sumatra while searching for about 240 prisoners who escaped following the riot at the facility in the nation's third-largest city.

Two prison employees were trapped and killed in an office building that was burned by prisoners during the riot, which appeared to have been triggered by a power blackout that knocked out water pumps, leaving inmates without water since Thursday morning.

Another employee was injured, Hadi said.

The facility holds nearly 2,600 prisoners while its normal capacity is 1,054, Hadi said.

Provincial police spokesman Col. Heru Prakoso said there were 14 convicted terrorists among the prisoners and nine escaped, but that five had been caught.

He said that it was initially thought there were 22 convicted terrorists, but that eight of them were moved recently to Aceh.

In Jakarta, Senior Security Minister Djoko Suyanto said 64 of the escaped inmates had been caught so far.

Medan, home to more than 2 million people, is Indonesia's third-largest city after Jakarta and Surabaya.

Witnesses said gunshots were heard from inside the prison Thursday night, and television footage showed security forces carrying a white body bag into an ambulance from the burning prison. The fire sent raging orange flames jumping several yards into the air and a huge column of black smoke billowed over the jail.

Vice Minister of Justice Denny Indrayana appealed to those who escaped to give themselves up to the police.

"Legal action will be taken to chase them, and tougher action will be applied to those who refuse to surrender," Indrayana said.