WHEN THE official result of Indonesia’s first closely contested presidential election is announced this week, a successful, albeit slightly rocky, transition of power could begin. But without acceptance of the outcome from both candidates, the announcement could result in unrest and threaten Indonesia’s 15 years of democratic progress.

The aftermath of July 9’s free and fair elections in the world’s third-largest democracy has been tense. On election night, reliable “quick counts” showed Joko Widodo, the governor of Jakarta and a populist reformer, edging out Prabowo Subianto by 4 to 6 percentage points. But Mr. Prabowo, a former soldier with ties to the last regime, said that his own quick counts showed him winning. “Don’t be provoked,” he said to his supporters. “It’s okay if there are claims and declarations of victory by others, but they are not based on the election law.” Since then, Mr. Prabowo has continued to insist that he won.

The candidate says that he will accept the official result, which is due by Tuesday. But some in his campaign have told supporters to “safeguard” the General Elections Commission building during the announcement, potentially triggering unrest if he loses. These supporters rallied with Mr. Prabowo throughout the post-election period, defying President Susilo Bambang Yudhoyono’s call for restraint. Most ominously, a few days before the election, Mr. Prabowo gave interviews in which he said that “losing is not an option” and questioned democracy’s suitability to Indonesian culture.

The uncertainty around Mr. Prabowo’s plans has fueled fear of the worst: violent unrest of a sort unseen since the country’s bloody 1998 democratic transition. Anxiety is heightened because of Mr. Prabowo’s continuing connections with the military. Any effort to reinvolve the armed forces in politics also would be a setback for democracy.

Mr. Prabowo and Mr. Joko’s responsibilities are clear: Both must accept the official election result. Neither has much reason to challenge the outcome in the constitutional court, which would pointlessly continue the nation’s agonizing wait.

To help the transition, Mr. Yudhoyono must ensure timely and clean vote-counting by his elections commission and deploy police around potential rally sites. The United States has responsibly waited for the official result before congratulating the victor, but it and its allies must quickly recognize the new president-elect.

With Thailand regressing after a military coup and reforms stalling in Burma, Indonesia has become the democratic leader of Southeast Asia. A relatively close election poses a new test. Mr. Prabowo and Mr. Joko can best serve their country and region by respecting the process that will culminate Tuesday.