Under a deal brokered by Secretary of State John Kerry, the two remaining candidates to be Afghanistan's next president have agreed to abide by the results of a full recount of the 8 million ballots cast in last month's election.
At least for now, the pact averts a political crisis and dramatically reduces the chances of bloody chaos as U.S. troops finally withdraw. Without the surprise agreement, many feared the country would split along political, ethnic and religious lines.
The situation is unstable already. A suicide bomber blew up a car near a busy market and mosque in eastern Afghanistan on Tuesday, killing dozens in one of the deadliest insurgent attacks since the 2001 invasion.
After Kerry led two days of intense negotiations, front-runner Ashraf Ghani and rival Abdullah Abdullah embraced and called each other brother. Abdullah had been accusing Ghani of stealing the election and threatening to create a parallel government.
The agreement calls for an internationally supervised audit of all ballots and for some kind of national unity government once there is a final result. The recount is expected to take several weeks, so the scheduled Aug. 2 inauguration has been postponed.
The Obama administration fervently hopes that whoever eventually wins is a more stable and less corrupt partner than Hamid Karzai. Unlike Karzai, both candidates have pledged to sign an agreement with the United States that would allow a phased pullout that is the best hope for a peaceful transition.
Under the plan announced in May by President Barack Obama, about 9,800 of the 32,000 American troops now in country would stay past this year, but only to train Afghan forces and to support limited counterterrorism missions from bases in the capital of Kabul.
A similar security pact didn't happen in Iraq — our other post-9/11 war — and look at the debacle there: sectarian violence, a weak government and the rise of a militant group that could threaten Americans. That is the last thing we should want in Afghanistan.