Indonesian presidential election candidate Prabowo Subianto has said he is withdrawing from the election process, alleging massive fraud.
The results of the hotly-contested poll are due in the next few hours. Early projections have put Joko Widodo in the lead.
But Mr Subianto told reporters there was massive systemic fraud and vowed to challenge the results in court.
He added that his camp would not resort to violence.
Most "quick counts" after the 9 July election had placed Mr Widodo, the popular Jakarta governor, in the lead.
But his rival Mr Subianto, a former military general under Suharto, said earlier that other polls showed he had won.
The Election Commission has since been tallying votes. Outgoing President Susilo Bambang Yudhoyono has urged both parties to respect the result.
Security is tight for the announcement, with more than 250,000 police officers on duty across the nation.
There are fears the result could trigger violence between rival groups of supporters.
Both candidates have raised concerns about voting irregularities during the past two weeks, as ballots from nearly 500,000 polling stations have been tallied.
Reliable polls point to a win for Mr Widodo, also known as Jokowi, by about five percentage points.
Official results from the sub-district and provincial levels that have been released so far also indicate Mr Widodo has won by between three and five percentage points.
But Mr Subianto's camp have said they will not accept official results until allegations of cheating are probed.
Mr Subianto told reporters on Sunday that if the Election Commission did not investigate possible voting fraud, that was a "crime" that "very much calls into question the legitimacy of the whole process".
He called on the Election Commission to delay announcing the result - a request the commission rejected.
How media responded to poll rejection, BBC Monitoring
Just before 0800 GMT the breaking news website Detik.com reported that Prabowo Subianto had pulled his election observers out of the final stages of the official count and announced his rejection of the result.
At the same time, key figures in his coalition, including the leaders of the powerful Golkar Party, were urging Mr Subianto to concede defeat and abandon plans to mount a challenge through the constitutional court.
A headline on Detik.com which has been retweeted several hundred times says: "The statement rejecting the election was in Prabowo's name alone".
After Mr Subianto's defiant withdrawal from the electoral process, his own spokesman, former constitutional court justice Mohammad Mahfud, resigned.
On his Facebook page, Mr Subianto continued to claim that electoral violations in Papua, East Java and Jakarta made the official result suspect, although the deficit is so great - over 8 million votes - that it would not be affected by those results being overturned.
The candidate tipped to win, Joko Widodo, told the Jakarta Globe: "I'm sure Prabowo, as a statesman, will put the national interest above all."
On social media the mood turned against Prabowo Subianto, with one of the top trending tweets being a play on an English phrase: "Let it go Prabowo".
The hashtag #presidenbaru ("new president") was also a vehicle for mockery of Prabowo, with many tweets containing terms like "drama queen", "cry baby" and "sore loser".
The outgoing leader, Mr Yudhoyono, has called for calm, urging all Indonesians "to safeguard the final chapter of the election process".
"It is important to value our unity, brotherhood and togetherness. When a nation is divided, to reunite is not easy," he said at a meeting on Sunday with both candidates.
On Monday Mr Yudhoyono - whose party backs Mr Subianto - also appeared to suggest that he should accept the results, saying: "Conceding defeat is noble."
Candidates have two weeks to appeal to the constitutional court following the announcement of official results.
About 130 million votes were cast on 9 July following an intense election campaign.
The race has been seen as a contest between new and old-style politics. Mr Widodo draws his support from the grass-roots and is unconnected to the traditional elite.
Mr Subianto, meanwhile, is the son-in-law of Suharto and has faced multiple questions over alleged human rights abuses under his regime.