Authorities are searching for scores of inmates, including convicted terrorists, who escaped from a crowded Indonesian prison after prisoners set fires and started a deadly riot at the jail in the nation's third-largest city.

Thousands of policemen and soldiers were deployed around Tanjung Gusta prison to blockade roads linking Medan, the capital of north Sumatra, to other provinces while fire brigades fought the fires on Friday.

About 200 prisoners escaped after the riot late on Thursday in which three prison employees and two inmates were killed.

By Friday security forces had retaken control of the prison after soldiers entered without resistance, prison directorate spokesman Akbar Hadi said.

Officers have rearrested 55 inmates and were still searching for the rest, said local police chief Lieutenant-Colonel Nico Afinta. Three convicted terrorists had been recaptured.

He said the prison employees who died, including a woman, were trapped and killed in an office building that was burned by prisoners during the riot.

Indonesian police spokesman Boy Rafli Amar said 15 prisoners who escaped were believed to be "terrorists". Those 15 are believed to have links to Toni Togar, who is serving a 20-year sentence in a different prison for a series of church bombings in Sumatra in 2000, the Jakarta Post reported on Friday.

The riot appeared to have been triggered by a power blackout that knocked out water pumps, leaving inmates without water since Thursday morning.

The jail was holding nearly 2,600 prisoners but its normal capacity was 1,500, Hadi said.

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

Hadi estimated about 500 inmates were resisting calls to stop the riot and said an evacuation was planned for the safety of inmates who could become hostages as tensions showed no signs of easing.

Vice minister of justice Denny Indrayana, who is in Medan overseeing the operation, has requested evacuation of all inmates and appealed for those who escaped to give themselves up.

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