More than 192 million Indonesians are eligible to vote in presidential and parliamentary elections on Wednesday after campaigns focused on the economy, but with political Islam looming large over the world's biggest Muslim-majority nation.
President Joko Widodo, a former furniture salesman who launched his political career as a small-city mayor, is standing for re-election in a contest with ex-general Prabowo Subianto, whom he narrowly defeated in 2014.
As conservative Islam gains traction, politicians including Widodo have taken pains to appear more Islamic. The worry for investors is that the appeal for conservative votes will translate into populist policy.
Most opinion polls give Widodo a double-digit lead but the opposition has disputed survey findings. Some recent surveys have shown Prabowo catching up.
The opposition has also said it has uncovered data irregularities affecting millions on the electoral rolls and has vowed to take legal action or use "people power" if its complaints are not resolved.
The election is a huge logistical operation in the world's third-largest democracy with 245,000 candidates vying for votes in what is described as the world's biggest single-day election.
Nearly 350,000 police and military personnel, in addition to 1.6 million paramilitary officers, will fan out across the archipelago of 17,000 islands to safeguard the vote.
More than 10,000 people have also volunteered to crowd-source results posted at polling stations in a real-time bid to thwart attempts at fraud.
Polling stations will open at 7 a.m. (2200 GMT on Tuesday) in the east and close at 1 p.m. (0600 GMT) in the west.
Unofficial "quick counts" will be released hours after polling ends and the winning presidential candidate is expected to be apparent by late Wednesday.
The General Election Commission is expected to announce an official result in May.
THE "NEW FACE" IN POLITICS, WIDODO SEEKS A SECOND TERM
When Widodo was elected five years ago he offered a break from the military and political elite that had clung to power since the fall of strongman ruler Suharto in 1998.
Now, Widodo, 57, is running on his own record for a second term.
With his easy smile and signature "blusukan", or impromptu walkabouts, he came to power on a wave of support for a clean, can-do image he cultivated as a small-city mayor, and then as governor of the capital, Jakarta.
Still, during his political rise, Widodo, a moderate Muslim from the city of Solo in Java island, has had to fend off smear campaigns suggesting he was anti-Islam, a communist or in debt to China. On Sunday, he made a pilgrimage to Islam's holiest site, Mecca in Saudi Arabia.
As president, Widodo was saddled with expectations he could fix a host of problems, from human rights abuses to pervasive graft. Jokowi, as he is popularly known, also inherited an economy coming off a commodities boom, and faced an obstructive parliament.
He stitched together a majority in parliament and while unable to hit an economic growth target of 7 percent, led a push to build ports, roads and airports.
THE CHALLENGER - FORMER SPECIAL FORCES COMMANDER
Challenger Prabowo Subianto, 67, has long harbored ambitions for the top job and has cultivated a strongman image and ties with hardline Islamist groups in the hope of boosting his chances.
In the last election, in 2014, Prabowo, the head of the Great Indonesia Movement party, came within 6 percentage points of beating Widodo.
A former special forces commander, Prabowo comes from an elite political family. His father was one of Indonesia's most prominent economists, serving in the cabinets of both presidents Sukarno and Suharto. The latter was his father-in-law.
Prabowo has fired up his rallies with warnings the country is at the mercy of unspecified foreign powers and on the verge of fragmentation.
CLAWING BACK VOTER SUPPORT IN MUSLIM HEARTLAND
Since taking office, Widodo has made efforts to bring religious parties into his coalition, and to secure the backing of the conservative voters he failed to win over in 2014.
His decision to pick Islamic cleric Ma'ruf Amin, 76, as his running mate was part of a strategy to enhance his ticket's appeal among conservatives but it disappointed some of his moderate and progressive supporters, who say the president is pandering to conservatives and fear the erosion of Indonesia's reputation for religious tolerance and pluralism.
Widodo's aides say the mobilization of grassroots support and canvassing of thousands of Islamic schools in conservative provinces is crucial to prevent a repeat of 2014, when the opposition attacks cost him votes.
DISGRUNTLED RURAL VOTERS WEIGH OPTIONS
Economic growth has hovered at about 5 percent over Widodo's first term, but there has been a drop in real income for its nearly 40 million farmers, who account for a third of the labor force.
Widodo has sought to tame inflation with a cap on prices of staples such as rice and shallots, and to import more food. He remains popular in many rural areas though some farmers are considering the opposition even though Widodo has led an infrastructure drive that has improved access to markets.
Prabowo has said some of Widodo's infrastructure projects have failed to help ordinary people.
THE FRONT LINE OF THE SOCIAL MEDIA ELECTION BATTLE
This election has been fought out over social media as never before. So-called buzzer teams have proliferated, named for the buzz they aim to create, to spread propaganda on behalf of both Widodo and Prabowo, sometimes with fake accounts.
Under Indonesia's broad internet defamation law, creating and spreading fake news is illegal, but holding social media accounts in false names is not, unless a real person is being impersonated. Both campaign teams deny using buzzers or spreading fake news.
Misinformation is rampant on Facebook, which counts Indonesia as its third-largest market globally with an estimated 130 million accounts, as well as on its Instagram and WhatsApp affiliates and rival service Twitter.
The companies say they are working with the government and fighting false content.
PUSHING THE ENVELOPE IN INDONESIA'S MONEY POLITICS
Indonesia has some of the worst money politics in Southeast Asia, according to researchers. Handouts of cash and gifts, anti-graft advocates and politicians say, lead to rampant corruption as successful candidates recoup election expenses, and more, once elected.
Envelopes, usually stuffed with cash ranging from 20,000 to 100,000 rupiah ($1.42 to $7.08), are commonly doled out to voters. Though small amounts, the overall cost can be huge over a six-month campaign.
The going rate for a serious run for one of 560 seats in the national legislature is about 10 billion rupiah, or $708,000, according to the former deputy chief of the Corruption Eradication Commission.
Those aged between 17-35 account for over one third of Indonesia's 193 million voters. Both Widodo and Prabowo ramped up efforts to appeal to them, deploying everything from holograms, campaign messaging in comic strips, and breakdancing.
PALM OIL CENTRAL TO ENERGY SELF-SUFFICIENCY PLEDGES
Both candidates have pledged to achieve energy self-sufficiency by boosting the use of bioenergy, particularly from palm oil. Indonesia opposes a European Union plan to curb the use of palm oil over deforestation concerns.