A week ago the political system fostered by the United States in Afghanistan was on the brink of collapse, with a new civil war being the likely result. After Afghan election authorities announced the preliminary results of a presidential election runoff, the apparent loser, Abdullah Abdullah, readied what looked to some like a coup, dispatching forces to Kabul police stations and lining up provincial governors to endorse his announcement of a government.
Timely phone calls to Mr. Abdullah and rival Ashraf Ghani, first by Secretary of State John F. Kerry and then by President Obama, temporarily defused the crisis. Now Mr. Kerry has brokered an accord that appears to establish a clear plan for arbitrating the dispute over the election and establishing a stable government a turnaround so remarkable that the U.N. representative in Kabul is calling it "not just a top-notch diplomatic achievement [but] close to a miracle."
Mr. Kerry himself is rightly cautioning that "we haven't won yet"; the delicate and complex deal must be implemented over weeks. But his weekend diplomacy in Kabul has created a real chance for a peaceful transition of power this summer, rewarding the millions of citizens who turned out to vote and creating a government that could continue to attract Western support.