Indonesian authorities have begun evacuating foreigners and women from a jail on the resort island of Bali that was taken over by rioting inmates.
Twelve convicted Australian drug smugglers and 48 other foreigners have been housed together with about 1,000 other inmates at the notorious and overcrowded Kerobokan jail.
The evacuation that began near dusk brought calm after a day of mounting tensions between inmates and some 500 police and military massed outside.
The first prisoners boarded buses outside the prison's main entrance, where armoured vehicles and water cannon were positioned since before dawn as authorities tried to negotiate with inmates holed up inside.
Four Western men were driven away on one of the buses, followed by nine women - including Westerners and Asians - on a second bus. Seventeen Indonesian inmates were seen leaving aboard a third bus.
Provincial military command spokesman Wing Handoko, who had insisted that all of the foreigners would be evacuated by day's end, later said no more would be moved before Friday.
"We decided to stop the evacuation and continue tomorrow because of the late hour. It will be better to continue tomorrow," he added.
Police and military forces had stormed the overcrowded jail at dawn on Wednesday to wrest control after a night of arson and stone-throwing, only to have the inmates take over the jail again later that day.
Officials would not openly say whether inmates still controlled the prison, but there was no indication the guards were back in charge.
Bali police spokesman Hariadi, who like many Indonesians goes by a single name, said the situation inside had calmed markedly after a day of mounting tensions when security forces appeared to be ready to storm the prison.
"Following mediation, the prisoners have promised not to cause any more anarchy," Hariadi said.
About 100 heavily armed police, armoured vehicles and a pair of water cannon remained positioned outside the prison walls after the buses left and hundreds of security forces moved out.
It was unclear how many of the Australians were among the evacuees from Kerobokan, which housed 1,015 inmates - more than three times its intended capacity.
Convicted Australian drug smuggler Scott Rush, a member of the so-called Bali Nine gang who is in his 20s and serving a life sentence, was seen leaving in a police car with sirens blaring.
Bambang Krisbanu, a security official at the justice ministry, said most of the Australians had chosen not to be evacuated, including convicted drug trafficker Schapelle Corby.
Handoko earlier said all foreigners and the prison's 125 female inmates would be moved because authorities feared for their safety.
"There is a big possibility that the foreign inmates could be used by the rioting inmates as bargaining chips to press for their demands," he said.
The rioters' main demand has been that three inmates injured in the first night of violence and taken to hospital be returned to the prison, fearing they were being mistreated.
But authorities said they would not be pressured into giving in to their demands.
Officials and media reports said the trouble began after one of the inmates was stabbed on Sunday, triggering reprisals among prisoners that spun out of control and forced the guards to abandon the facility.
Prison worker Aryawan said it was the worst riot he had seen in five years working at the prison, which is notorious for violence, and located just a few kilometres from the tourist beaches of Kuta.
"We're fine, we're fine but there's no food," an inmate shouted to a passing reporter from a guard tower as five other shirtless and tattooed prisoners flashed "thumbs-up" signs.
Kerobokan is one of Indonesia's most notorious prisons, with a volatile mix of inmates including convicted murderers, sex offenders and others guilty of violent crimes.
There have been a number of riots there in recent years, including one triggered by a police drug raid in June.
Australia's foreign ministry said that all 12 Australian prisoners at Kerobokan, including two on death row and six serving life sentences, were accounted for.