An Indonesian court sentenced the minority Christian governor of Jakarta to two years in prison on Tuesday for blaspheming the Qur'an, a jarring ruling that undermines the reputation of the world's largest Muslim nation, known for practising a moderate form of Islam.

In announcing its decision, the five-judge panel said Gov. Basuki "Ahok" Tjahaja Purnama was "convincingly proven guilty of blasphemy" and ordered his arrest. He was taken to Cipinang Prison in east Jakarta.

Photos quickly appeared online of Ahok — who still commands immense popularity in the capital of Jakarta — being warmly greeted by prison staff. Ahok said he would appeal, but it was unclear if he would be released once that process is underway.

The judge has become a representative of God. — Hardliner Syamsu Hilal

At the court, supporters of the governor wept and hugged each other amid shouts of jubilation from members of conservative Islamic groups. The accusation of blasphemy engulfed Ahok in September after a video surfaced of him telling voters they were being deceived if they believed a specific verse in the Qur'an prohibited Muslims from voting for a non-Muslim leader.

A supporter weeps near the court following Ahok's conviction of blasphemy in Jakarta. (Darren Whiteside/Reuters)

Massive street protests in the past six months against Ahok and Tuesday's verdict are among the signs of an increasing religious conservatism in Indonesia. In Western capitals, the country has traditionally been seen as a bulwark of tolerance and pluralism in the Islamic world. Vigilante groups frequently attempt to prevent Indonesia's religious minorities from practising their faiths, and the country's gay community has faced a surge in persecution in the past two years.

This … is character assassination of a good governor. — Ahok supporter Adrian Sianturi

The blasphemy case was a decisive factor in Ahok's defeat to a Muslim candidate in last month's election for Jakarta governor. Hardline Islamic groups opposed to having a non-Muslim leader for the city capitalized on the trial to draw hundreds of thousands to anti-Ahok protests in Jakarta that shook the centrist government of President Joko "Jokowi" Widodo.

"Hardliners will feel emboldened by the ruling, given that the trial represents a wider tussle between pluralism and Islamism in Indonesia," said Hugo Brennan, an analyst at Verisk Maplecroft, a political risk assessment firm in Singapore.

Court hands Christian governor two-year sentence for blasphemy 0:55

Outside the court, Syamsu Hilal, a member of a hardline Muslim group who reported Ahok to police last year, said justice had been upheld.

"Here we have witnessed that the judge has become a representative of God," he said.

The sentence was also welcomed by the youth arm of Muhammadiyah, Indonesia's second-largest mainstream Muslim organization.

But Ahok supporter Adrian Sianturi said the trial was a victory for intolerance and corruption.

"This decision is the character assassination of a good governor, a clean politician who is rare in this country," he said.

The two-year prison sentence was a surprise outcome after prosecutors had recommended two years of probation. The maximum sentence for blasphemy in Indonesia is five years in prison.

Hardline Muslims react after hearing the verdict. The blasphemy case was a decisive factor in Ahok's defeat to a Muslim candidate in last month's election. (Beawiharta/Reuters)

The lead judge, Dwiarso Budi Santiarto, said the trial was a purely criminal one and that the court disagreed that there were political aspects to the case.

He said Ahok's comments during the election campaign had degraded and insulted Islam.

"As part of a religious society, the defendant should be careful to not use words with negative connotations regarding the symbols of religions including the religion of the defendant himself."

Wayan Sudirta, a lawyer for Ahok, said there was "so much pressure" for Ahok to be imprisoned. "We can understand but we cannot accept the verdict. Therefore we will appeal," he said.

Ahok rose from deputy governor in 2014 after Jokowi vacated the capital's governorship following his victory in Indonesia's presidential election that year.

He was popular with Jakarta's middle class for efforts to stamp out corruption and make the teeming city more livable. But others were alienated by Ahok's outspokenness and the demolition of slums that were home to Jakarta's poorest residents.