One person has died and seven have been injured in clashes in Jakarta, police said, after a protest by hardline Muslims demanding the arrest of the Indonesian capital's minority-Christian governor for alleged blasphemy.
Police spokesman Awi Setiyono said an elderly man died, possibly from the effects of tear gas. He added that four civilians and three police officers were injured.
Clashes broke out between police and protesters who refused to disperse after nightfall. Police fired tear gas and water cannons and protesters set alight two police vehicles and piles of rubbish left behind from the protest, which drew tens of thousands of people.
Mr Setiyono said police responded after protesters near the presidential palace threw stones, bamboo sticks and bottles. The confrontation subsided after a protest leader appeal for calm.
MetroTV reported that a mob tried to enter the housing complex where governor Basuki "Ahok" Tjahaja Purnama lives in northern Jakarta but were stopped by police, who fired tear gas.
Mr Setiyono said rioting in north Jakarta involving the looting of a convenience store and damage to police vehicles had been brought under control, but live TV footage showed a stand-off continuing between police and a mob.
Fearing violence, police put on a show of force for the protest, supported by soldiers and public order officers, while embassies closed, some shops closed and Jakarta's normally traffic-clogged streets were nearly empty of cars.
The demonstrators had massed at the Istiqlal Mosque for the protest after Friday prayers and marched on the nearby presidential palace. Large protests also took place in other cities including Medan on Sumatra, Makassar in Sulawesi and Malang in East Java.
Members of an Islamic student group threw plastic water bottles and other objects at riot police in Jakarta, but the massive demonstration appeared to have gone off without any major incident during the day.
In a televised address, president Joko "Jokowi" Widodo said the riot showed "political actors have taken advantage of the situation". He did not identify any individual as responsible, but earlier in the week former president Susilo Bambang Yudhoyono went on national television to say he supported plans for the massive protest.
"They should have dispersed, but instead they turned to rioting," Mr Jokowi said of the protesters.
The accusation of blasphemy against Mr Purnama, an ethnic Chinese and minority Christian who is an ally of the president, has galvanised his political opponents in the Muslim-majority nation of 250 million, and given a notorious group of hardliners a national stage.
The Islamic Defenders Front, a vigilante group that wants to impose Shariah law, is demanding Mr Purnama's arrest after a video circulated online in which he joked to an audience about a passage in the Koran that could be interpreted as prohibiting Muslims from accepting non-Muslims as leaders.
The governor has apologised for the comment and met police.
Mr Purnama, who is seeking a second term as Jakarta governor, is popular with the city's middle class. He is admired as a blunt speaker who does not tolerate corruption and articulates a vision of making the chaotic, dysfunctional city more like clean, orderly and efficient Singapore.
But the anti-corruption stance has made him enemies, and the evictions of thousands of the city's poorest people to make way for urban improvement has stoked anger and resentment and played to a stereotype of Chinese as exploiters of Indonesia's poor Muslim masses.