A poster in Jakarta, Indonesia, shows Habib Rizieq, the head of the hard-line Islamic Defenders Front, which opposed the incumbent Christian governor of Jakarata, Basuki Tjahaja Purnama, in an election April 19, 2017. (Ed Wray/Getty Images)

Jakarta’s first Christian governor in generations lost his reelection bid Wednesday, according to unofficial results, after a heated sectarian campaign that underscored the influence of hard-line Islamists in the world’s most populous Muslim nation.

Although the results were not final, early counts showed a decisive victory for Anies Baswedan, a Muslim candidate whose supporters portrayed the race as a referendum on the power of Islam in shaping the politics of Indonesia’s capital.

The outcome also raised questions about whether moderate Muslim political factions could face increasing pressure from hard-line groups energized by the Jakarta victory.

The incumbent governor, Basuki Tjahaja Purnama, was known for tough anti-corruption drives and challenges to hard-line Muslim groups that have taken on an increasingly central role in Indonesian politics. Comments he made last year led to charges of blasphemy that hung over the campaign. His blasphemy trial resumed Thursday with prosecutors calling for two years’ probation, meaning he probably would not face jail time even if convicted. The maximum penalty for blasphemy is five years in prison.

“You won’t see a governor as clean as Ahok again,” said Tsamara Amany, a university student and activist, referring to the governor by his nickname. She called Purnama “a symbol of tolerance.”

But Indonesia’s Islamist groups waged powerful opposition, holding rallies that brought out hundreds of thousands of people.

[How comic book super heroes became part of the Jakarta election]

Baswedan’s apparent large margin of victory — 58 percent to 42 percent in an unofficial tally — contrasted with some polls pointing to a far closer race. Purnama won the first round of voting for governor in February in a three-way race. Official results of Wednesday’s voting are to be announced in early May.

The election also underscored the country’s political rifts on the eve of a visit by Vice President Pence, who is scheduled on Thursday to visit Jakarta’s Istiqlal Mosque, the largest in Southeast Asia.

The blunt-speaking Purnama charged during the campaign that his Islamist opponents were betraying the constitution, and he urged Muslim voters in stump speeches to ignore imams who say Jakarta must have a Muslim governor.

Baswedan, a smooth-talking former education minister, appealed for tolerance while also playing to hard-line sentiment. He declared that, as a Muslim, he would never vote for a Christian.

“I don’t really care about who would be governor,” said Alissa Wahid, a prominent progressive activist. “But I am scared for the swinging pendulum of social change, especially in the Muslim community. They used mosques to spread hateful sentiments, and I am scared of the repercussions.”

In the election’s first round, held in February, Purnama received 43 percent of the vote against two Muslim opponents. In the decisive runoff, he got around 42 percent — suggesting that he had hit his ceiling during the first contest. The population in Jakarta and the surrounding region is about 85 percent Muslim.

[An Indonesian fatwa against “fake news”]

“It’s the downside of democracy. The best one doesn’t always win,” said Joko Anwar, a prominent film director and backer of Purnama. “It’s going to give the intolerant groups more room and justification for what they have been doing, so they’ll keep doing it even more.”

While the election sloganeering was mainly expressed in religious terms, the vote also reflected class tensions in a country with some of the starkest income inequalities in the world, analysts said.

Purnama was overwhelmingly supported by the middle and upper class, but he alienated poorer constituencies with his harsh eviction policies in the north of the city.

“There’s a wide, disenfranchised social base that looks elsewhere than politics for representation,” notably to Islamist hard-liners, said Ian Wilson, a lecturer and research fellow at Murdoch University in Perth, Australia, who has researched the attitudes of Jakarta’s poor communities.

In the Kebun Kacang area of central Jakarta, a maze of narrow streets with a mosque on nearly every corner, working-class residents strongly favored Baswedan. “I will be supporting the Muslim,” said young woman in a headscarf who declined to give her name.

But a short walk away from Kebun Kacang, Jakarta transforms into wide boulevards and huge shopping malls.

Trisha Dharmono, who works as an attendant in the Grand Indonesia shopping mall, said she is a Muslim but voted for Purnama because she thought he was effective. “My religion is my own business, not the business of imams,” she said.

Savic Ali, a progressive Muslim who runs news websites for Nahdlatul Ulama, the nation’s largest Muslim organization, said he was worried about the future.

“Although I feel that Anies is pretty tolerant, his victory will push the intolerant groups that backed him to spout their views yet more aggressively,” he said.

“That’s the challenge for Indonesian pluralism.”

Read more:

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news