Hammering a podium and railing against the rich and powerful, Prabowo Subianto, a former general now in the homestretch of Indonesia’s presidential campaign, whipped up the crowd of thousands.
“I am sick and disgusted with the evil elites in Jakarta!” he bellowed, referring to the Indonesian capital as he harangued his troops like the general he once was. “Disgusted! Always lie, lie, lie. Lie to the people!”
A microphone went flying as he hit the podium with his open hand. The crowd, at a rally last week in Yogyakarta, about 250 miles southwest of the capital, roared its approval, and he struck it again. His supporters chanted, “Prabowo! Prabowo!”
The message was a strange one, coming from the scion of one of Indonesia’s most powerful and politically connected families. But making his fourth and perhaps final try for the presidency, and trailing in the polls by double digits, Mr. Prabowo, 67, is pulling out all the stops.
The son of a Christian mother and the son-in-law of the former dictator Suharto, Mr. Prabowo has transformed himself this election cycle into a crusading populist and devout Muslim in a last-ditch effort to woo nationalists, hard-line Islamists and the large number of poor Indonesians who struggle to make a living.
Seemingly lost on many of Mr. Prabowo’s followers is that he was once a prime example of the elites he now attacks. Before Mr. Suharto’s ouster in 1998, the dictator plundered the country’s coffers to enrich himself and his family. As Mr. Suharto’s son-in-law and chief enforcer, Mr. Prabowo commanded the country’s feared Special Forces and acted with impunity to keep the regime in power.
For Indonesians, who go to the polls on Wednesday, the choice is whether to continue with the low-key, steady leadership of President Joko Widodo, 57, a former furniture manufacturer who was born in a slum, or Mr. Prabowo, a volatile ex-general who was dismissed from the army after ordering the kidnapping of political activists, and whose record on human rights earned him a yearslong ban on entering the United States.
Personality often prevails over ideology in Indonesian elections and the policy differences between the two candidates are not great. But with Mr. Prabowo’s courting of hard-line Islamists since his defeat in 2014, his victory would most likely mean advancing measures to promote Islam in daily life and greater military spending to rebuild the armed forces.
Winning the presidency would be a personal triumph for Mr. Prabowo and complete the remaking of his image. Mr. Prabowo has run for president in every national election since Mr. Suharto’s ouster in 1998.
Mr. Joko, fortified by the power of incumbency since their last face-off, can point to numerous accomplishments over the past five years, including expanding health care for the poor and building thousands of miles of rural roads, bridges, airports and a Jakarta subway and rail line that is hoped will ease the city’s notorious traffic.
Mr. Joko can also boast that Indonesia has bested foreign interests by regaining control of oil reserves, fisheries and mines, including the giant Grasberg gold and copper mine in the eastern province of Papua that is now run by an Indonesian firm after being operated by the American company Freeport-McMoRan.
And while Mr. Prabowo has the support of hard-line Islamists, Mr. Joko is well known as the more pious. The president can recite verses of the Quran and lead prayers at the mosque, something Mr. Prabowo does not attempt.
Whoever wins the presidency will have the challenge of leading the world’s fourth largest country, a vast archipelago of 17,500 islands that is rich in oil, minerals, fish and timber but notoriously difficult to govern.
Indonesia has struggled for decades to overcome widespread poverty and rampant corruption, improving modestly on both counts under Mr. Joko.
Officially a secular nation, Indonesia is nearly 90 percent Muslim and has more Muslims than any other country.
Indonesia has long been considered moderate in its practice of Islam but since the end of military rule, it has steadily grown less tolerant, with one province, Aceh, implementing Shariah law and many local governments adopting Islamic measures, such as requiring women and girls to wear hijabs, or head scarves.
In Southeast Asia, where autocratic rule is on the rise, Indonesia has remained one of the region’s strongest democracies.
A win for the quick-tempered Mr. Prabowo, however, could spell the return of a more autocratic government.
The country has never fully reconciled with the brutality of Mr. Suharto’s three-decade regime and few of the perpetrators were ever held accountable.
An estimated 500,000 suspected communists were slaughtered when the dictator took power in 1965. Many more people were killed in the following decades as Indonesia annexed and subdued the provinces of East Timor, Papua and Aceh.
After the regime’s collapse, Mr. Prabowo may have been singled out for punishment because of his family ties. Nevertheless, the findings of a 1998 inquiry into his conduct were damning.
A panel of seven generals, including a future president, Susilo Bambang Yudhoyono, concluded that Mr. Prabowo was insubordinate, disobedient and exceeded his authority by unilaterally conducting military operations in East Timor, Aceh and Papua.
The panel also found that he violated criminal law by ordering the kidnapping of activists opposed to his father-in-law’s rule.
The panel listed nine victims by name, all of whom survived. Some later told of enduring months of imprisonment and torture. Thirteen others have never been accounted for. One was found dead.
Mr. Prabowo has played down the kidnappings, and noted that some of the victims later supported him.
About 190 million people are eligible to vote on Wednesday, in the world’s largest direct presidential election.
As in many democracies, this election has at times turned ugly, as supporters of both candidates have turned to social media to smear the opposition.
Mr. Joko, for example, has been falsely accused of being a communist, having Chinese ancestry and being anti-Muslim. Mr. Prabowo says he has been wrongly accused of wanting to turn Indonesia into an Islamic caliphate.
“Both sides run a massive social media campaign,” said Abdul Malik Gismar, a lecturer at Paramadina University in Jakarta. “Both sides are also using hoaxes and half-truths. It solidifies the base, at least.”
On Friday, Facebook removed 234 pages, accounts and groups on Facebook and Instagram that were engaged in a coordinated effort to influence the election by spreading false information. The influence effort was aimed at helping Mr. Prabowo, said the Digital Forensic Research Lab, a group that seeks to expose disinformation.
Between the candidates themselves, however, the campaign has remained unusually civil.
During their March 30 debate, the candidates praised each other as patriots and affirmed their personal friendship.
“Let us show we are good leaders who never insult one another,” Mr. Joko said. “Let us be great examples of tolerance and friendship to the younger generation.”
Mr. Prabowo replied, “As this is a debate, if the audience sees us as being too friendly, then it is not exciting. But the truth is, we are friends. I am sure that we will continue to be friends. We both are fighting for the good of the people.”