Tens of millions of Indonesians will vote in presidential and parliamentary elections this week after campaigns focused on the economy, but with political Islam looming ever larger in 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.

Most opinion polls give Mr Widodo a double-digit lead, but the opposition has disputed survey findings and claimed it had uncovered data irregularities affecting millions on the electoral rolls.

The president’s opponents have vowed to take legal action or use “people power” if their complaints were not resolved.

Some analysts say an unexpected win for the challenger would probably cause a brief slump in Indonesian markets, while a very close race could elevate the risk of a disputed vote.

Indonesia's Rainbow Village Show all 13 1 /13 Indonesia's Rainbow Village Indonesia's Rainbow Village Rainbow village This once struggling village in Indonesia was given a rainbow makeover last month. Instagram/Arief Rakhman Indonesia's Rainbow Village Rainbow village The village in Randusari was formerly known as Kampung Wonosari but has been renamed Kampung Pelangi. Instagram/Ilham Juwarto Indonesia's Rainbow Village Rainbow village Local government allocated £17,000 for the bold new look. Instagram/Ribekti_H Indonesia's Rainbow Village Rainbow village It was hoped that by painting the village in bright colours it might attract more tourists to the area. Instagram/Jalidin Indonesia's Rainbow Village Rainbow village Alongside the rainbow stripes adorning the buildings, there are also interesting murals on the walls. Instagram/Ilham Juwarto Indonesia's Rainbow Village Rainbow village The village has been trending on social media and tourists are flocking there for Instagram shots. Instagram/Safir Makki Indonesia's Rainbow Village Rainbow village The project took just over a month to complete and was unveiled in April. Instagram/Ditopapaojan Indonesia's Rainbow Village Rainbow village A local teacher was the brains behind the project, inspired by similar makeovers in other parts of Asia. Instagram/nicolas_ertaf Indonesia's Rainbow Village Rainbow village The village was considered a slum before the local government officials decided to turn things around. Instagram/jogjajateng Indonesia's Rainbow Village Rainbow village A total of 232 buildings were transformed, and coloured flags line the streets. Instagram/mzndoet Indonesia's Rainbow Village Rainbow village The face lift has given a new lease of life to Kampung Pelangi, turning it into a must-visit attraction. Instagram/mzndoet Indonesia's Rainbow Village Rainbow village Most of the manpower and material was provided by The Indonesian Builders Association. Instagram/puchy.nisa Indonesia's Rainbow Village Rainbow village Even the Mayor of nearby Semarang, Hendrar Prihadi, got involved by doing some painting. Instagram/Cindy Kurnia Lestari

“In a scenario in which Mr Widodo wins by an unexpectedly narrow margin, large and prolonged protests in Jakarta would elevate tensions and pressure the currency,” said Kevin O’Rourke of the Reformasi Weekly Service, which analyses Indonesian politics.

While most polls have put the president ahead, the lead could not be taken for granted, a senior government official said.

“Absolutely everybody is flying blind because we don’t know how far the opinion polls can be respected,” added the official, who spoke on condition of anonymity.

Mr Widodo ended his six-month campaign with a mass rally at Jakarta’s main stadium at the weekend, where festive crowds overflowed into a surrounding park and streets.

Running out on stage in sneakers, to the cheers of the crowd after an hours-long concert by local bands, he struck an optimistic tone for the future of the world’s third-largest democracy.

That was a stark contrast to his opponent, who has repeatedly warned Indonesia is on the verge of collapse.

Mr Prabowo, as he is usually known, held a similarly big rally the previous weekend where supporters, many dressed in Islamic robes, held a mass prayer before a fiery speech about how Indonesia was being pillaged by foreigners and the elite.

Quick Counts

Mr Widodo has touted a record infrastructure drive and deregulation as major successes during his tenure, calling it a first step to tackle inequality and poverty in southeast Asia’s biggest economy.

In a televised weekend debate, Mr Widodo and his running mate, Islamic cleric Ma’ruf Amin, said their opponents, neither of whom has served in public office for more than a few months, did not understand managing macro-level economics.

Mr Widodo, a moderate Muslim from central Java, has had to burnish his Islamic credentials after smear campaigns and hoax stories accused him of being anti-Islam, a communist or too close to China, all politically damaging in Indonesia.

Mr Prabowo, who has close links to some hardline Islamist groups, and his running mate, business tycoon Sandiaga Uno, have pledged to boost the economy by slashing taxes as much as eight percentage points, and focus on key infrastructure projects.

Indonesia police admit using snakes to interrogate Papuan man

Nearly 500,000 police and military will fan out across the vast archipelago to safeguard the vote.

In Jakarta, the capital, officers will guard polling stations to deter voter intimidation or clashes, national police spokesman Dedi Prasetyo said.

More than 192 million people will also vote in national and regional legislative elections, being contested by more than 245,000 candidates, in what is being described as the world’s biggest single-day election.

Overseas voting is already under way, with thousands lining up outside Indonesian missions in Singapore and Australia.

On Wednesday, polling stations will open at 7am (10pm GMT on Tuesday) in eastern Indonesia and close at 1pm (6am GMT) on the western side of the country.

Voters will manually punch five separate paper ballots for president and vice-president, and legislative candidates.

Unofficial “quick counts”, based on vote samples from polling stations, 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.

Candidates have 72 hours after the official result to complain to the Constitutional Court. A nine-judge panel has 14 days to reach a decision, which cannot be appealed.