Supporters of the Christian ex-governor Basuki Tjahaja Purnama, popularly known as Ahok, have welcomed his release from prison.
Jakarta's former governor was released from prison, nearly two years after his blasphemy conviction fanned fears of religious intolerance in the world's biggest Muslim-majority nation.
Basuki Tjahaja Purnama -- the Indonesian capital's first non-Muslim governor in half a century and its first ethnic Chinese leader -- left a prison outside the capital after dawn, his assistant Ima Mahdiah told AFP.
Supporters of the Christian ex-governor, who is popularly known as Ahok, gathered outside the prison, chanting and cheering his new found freedom.
The release ends one of the most tumultuous chapters in Indonesian politics in recent memory.
Purnama had been a popular politician who won praise for trying to clean up the traffic-clogged megacity and clamp down on corruption before his imprisonment.
But his downfall came quickly after comments he made on the campaign trail during a re-election bid saw him accused of insulting Islam.
The filmed remarks, which went viral online, sparked mass protests in Jakarta, spearheaded by radical groups opposed to a non-Muslim leader and encouraged by his political rivals.
Purnama had urged voters to ignore rivals who cited a Koranic verse stating they should reject non-Muslim leaders, with the then governor saying people were being manipulated into voting against him.
However, judges ruled the remarks amounted to blasphemy against Islam and he was then sentenced to two years' jail in May 2017, having lost the election to a Muslim challenger.
It was an unusually harsh sentence -- prosecutors had only recommended probation for the now 52-year-old.
Purnama's case drew international headlines and a wave of criticism, including from the United Nations, which urged the country of 260 million to revise its decades-old blasphemy law.
"Ahok's unjust conviction is a reminder that minorities in Indonesia are at risk so long as the abusive blasphemy law remains in place," said Elaine Pearson of Human Rights Watch.
"Islamists will use it to bring wrongful prosecutions and even more discriminatory regulations against religious minorities."
The huge demonstrations calling for Purnama's jailing fuelled concerns about the growing influence of religious hardliners and that the Southeast Asian country's much-vaunted tolerant brand of Islam was under threat.
Indonesia's blasphemy law states that anyone found guilty of "expressing feelings of hostility" towards religion can be jailed for up to five years.
It applies to any of the six officially recognised religions, including Christianity, Buddhism and Hinduism, but most prosecutions are brought against people accused of blaspheming Islam, which is followed by nearly 90 percent of the population.
Among them was an ethnic Chinese Buddhist woman found guilty in August of insulting Islam for asking her neighbourhood mosque to lower the volume on its sound system. She was sentenced to 18 months in jail.
The woman's comments about the mosque noise triggered riots in 2016 that saw angry Muslim mobs ransack Buddhist temples.
Some ethnic Chinese in the area fled in fear.