People line up to vote at a polling station Wednesday in Bogor, Indonesia. (Achmad Ibrahim/AP)

Indonesian President Joko Widodo appeared on track Wednesday to win a second term, according to early vote counts, holding a 10 percentage-point lead over a retired general who had courted nationalist and conservative Islamic forces in a campaign waged on the country’s fault lines.

Widodo’s apparent victory over Prabowo Subianto marked a rare bright spot in a region that has trended toward authoritarian and strongman rule.

But Prabowo issued his own claim that he was the rightful victor, urging supporters to ensure the election is not taken from them even as the early “quick count” vote went strongly in Widodo’s favor.

In Indonesia, a quick count by several trusted independent polling agencies is considered an accurate gauge of the elections and correctly tallied Widodo’s 2014 win. Official vote counts in the sprawling archipelago could take up to two weeks as ballots come in from remote locations. The independent agencies tally votes from a representative sample of polling stations.

Prabowo did not signal his next possible move, but his defiant stance raised the possibility of street protests if Widodo’s victory is confirmed.

So far, however, the election was overwhelmingly peaceful and orderly. It further underscored an important shift in Indonesia to democratic elections in the world’s most populous Muslim-majority nation two decades after the bloody end of authoritarian rule under President Suharto.

Widodo urged supporters to wait for official results as they broke out in cheers, chanting his nickname, Jokowi, and heralding his reelection.

“From the implication of exit polls and quick count, all of which we’ve seen, we have to be patient until [the election authority’s] calculation,” he said.

Widodo was gathered with his inner circle, including his running mate, influential cleric Maruf Amin, and the head of his political party, former president Megawati Sukarnoputri, at a ballroom in central Jakarta, smiling and laughing as the unofficial results came in.

If his lead of about 10 percentage points holds, it would be more comfortable than his six-point victory in 2014. Indonesian presidents are elected by direct popular vote.

But Prabowo, reprising a similar move following his presidential election defeat in 2014, refused to concede. In comments to reporters, he said exit polls show he had won, and he disputed the preliminary results from the independent surveys.

“I will be and have already become the president of all Indonesians,” he said in a second victory speech Wednesday, claiming he had won with 62 percent of the vote, revised from his earlier assertion of taking 52 percent earlier. “We will build a victorious Indonesia, a just and prosperous Indonesia, peaceful and a force to reckon with in the world.”

For Widodo, victory would represent an endorsement of his moderate, steady brand of leadership, which has focused on infrastructure development and welfare programs for the poor. His rival, 67-year-old Prabowo, is a retired lieutenant general and son-in-law of Suharto. He was blacklisted from entering the United States for years because of his human rights record.

In his campaign, he railed against elitists, promised self-sufficiency for Indonesia and vowed to do more for the poor. He also played to a base of Islamic conservative voters, pledging to be a strong defender of the religion.

More than 192 million eligible voters fanned out to 800,000 polling stations scattered across hundreds of islands in the archipelago, and 6 million electoral workers staffed the mammoth and mind-boggling logistical operation. All modes of transportation, from boat to horse, were used to transport ballot boxes.

The election was colored by identity politics and the role Islam should play in Indonesian society and politics. Despite Widodo’s apparent win, critics and some of his early supporters say the shine has rubbed off the president, a 57-year-old former furniture salesman who rose from political obscurity to win in 2014.

Over the past five years, his critics charge, he has been weak on human rights and has not done enough to protect religious minorities, instead playing to those who think he will not protect Islam in Indonesia by choosing an influential cleric as his running mate. Analysts say he is trying to appeal to more moderate Muslims, rather than those who want Islam to have a bigger role in Indonesian politics.

Ruth Ogetay, a 34-year-old women rights’ activist for Papua, Indonesia’s easternmost province and the scene of frequent violence in response to calls for independence, could not bring herself to vote for either candidate.

“Until the end, rights abuses in Papua will never end,” she said. “Jokowi getting elected won’t stop human rights abuses being perpetrated.”

The peaceful and sometimes jubilant process on Wednesday, with voters proudly holding up their pinkie fingers marked with indelible ink and taking post-voting selfies outside polling stations.

A 48-year-old voter who identified herself only as Lydia said she believed the divisive campaigns playing to religion were only on the surface. Along with other voters, she sang Indonesia’s national anthem, “Indonesia Raya,” as people cast their ballots.

“Here in this place, we’re just cool with one another. Only a small group of people are like that,” she said, adding she has never missed an election.

Mahtani reported from Hong Kong.