Police rolled out more barbed wire on Monday to tighten security outside Indonesia's election agency and readied armoured trucks and water cannons to quell any civil unrest when official results of a presidential poll are released this week.
With the General Election Commission (KPU) set to declare its count from last month's election by Wednesday, authorities have detained dozens of militant Islamists suspected of planning attacks to create mayhem during demonstrations.
The result is expected to confirm unofficial counts by private pollsters that put incumbent President Joko Widodo about 10 percentage points ahead of challenger Prabowo Subianto.
Although independent observers and analysts have said the poll was free and fair, Prabowo has refused to concede defeat, with his campaign team making accusations of "massive cheating and irregularities" during the vote and vote-counting.
The retired general has said the situation could trigger "people power"-style protests, while the government and police have urged protesters to keep the peace and vowed action against anyone stirring unrest.
Indonesia's election supervisory panel has dismissed two official complaints of election cheating, on grounds of insufficient evidence of violations.
Heavily armed security stood guard outside the election commission in central Jakarta, some accompanied by police dogs.
Last week, chief security minister Wiranto ordered police and military across Indonesia to prevent people from travelling to Jakarta en masse to join protests.
In East Java province, more than 1,200 Prabowo supporters were stopped from travelling to the capital.
"These people were attempting to travel by bus, car and train to join the rallies on May 22," said East Java police spokesman Frans Barung Mangera. "We prevented them."
Indonesia's biggest Islamic group, Nahdlatul Ulama, has also urged people to avoid rallies, saying its mosques would not accommodate protesters from outside the capital, except for prayers, media said.
National police, who report directly to Widodo, have also held or interrogated at least three leading opposition figures for suspected treason.
Last week, police said they had detained about 30 suspected militants with ties to Jemaah Ansharut Daulah (JAD), Indonesia's largest group linked to Islamic State, including some capable of using Wi-Fi networks to trigger blasts.
In a security alert, the U.S. embassy in Jakarta advised citizens to avoid the sites of large demonstrations. The Australian embassy also warned that protests could unexpectedly turn violent.
Widodo now leads with 55% of the vote, while Prabowo has 45%, according to the panel's official count of nearly 90% of votes.
Once the official result is released, the losing party can lodge a legal challenge at the constitutional court. Otherwise, the commission will officially declare the winner by May 28.
Prabowo has not yet confirmed if he intends to go to court, but his challenge to his 2014 defeat by Widodo was rejected.