As the sun went down over Kabul on Saturday July 13, Afghanistan’s future hung in the balance. Accusations of fraud in the country’s recent presidential election had paralyzed the country’s politics and threatened to trigger a civil war that could destroy the progress America’s costly military and diplomatic efforts had delivered since 2001. The parties in the dispute had convened at the residence of the American ambassador in Kabul, but the two sides couldn’t reach agreement.
Secretary of State John Kerry arrived on the scene that Saturday evening just as key Afghan players were headed out to the patio for their evening prayers. Scheduled to depart 90 minutes earlier for Vienna, where he was to join the ongoing international negotiations with Iran over its nuclear program, Kerry had delayed his departure to make a last ditch effort to broker a deal.
It was a dangerous moment, and not just for the Afghans. Without an agreement between second place finisher Abdullah Abdullah and the election’s declared winner, Ashraf Ghani, Afghanistan was at risk of an implosion like the one that enabled the Taliban to take power in 1996—creating a safe haven for Osama bin Laden to plot the 9/11 attacks. And Kerry’s visit defied the advice of other Obama officials who warned any diplomatic intervention on the U.S. part held “the risk of complete failure,” in the words of a senior official.
The details of how Kerry defused the stalemate, based on accounts from a half-dozen officials familiar with the talks, reveals an Afghanistan closer to the brink than many outsiders may appreciate. It also illuminates rare foreign policy win for Kerry and for an Obama administration staggered by months of setbacks, one whose importance has been overshadowed by turmoil in the Middle East and Ukraine. Finally, it shows how fragile the country remains as the U.S. prepares to withdraw the last of its combat troops later this year.
The crisis was the result of the inconclusive June 14 presidential vote to replace the longtime Afghan ruler Hamid Karzai. Abdullah, the losing candidate, was insisting the vote had been rigged to the tune of hundreds of thousands of fraudulent ballots. By mid-July, Abdullah’s supporters had threatened to create a kind of protest government. Rumors swirled of an armed rebellion, with the potential to ignite dormant ethnic and tribal rivalries. “We will accept death but not defeat,” Ghani’s running mate, the notorious ex-warlord Abdul Rashid Dostum, had recently vowed. “It was pretty frightening. People were preparing for civil war,” says one official.
On July 8 President Obama called Abdullah directly, warning that American aid to country could be cut off if he didn’t stand down. The call bought time but didn’t resolve the core dispute. “The president’s role was to intervene at a point where it looked like the dispute was threatening the stability of Kabul and the country. But that didn’t necessarily mean there was enough pressure to come to an agreement,” says one senior administration official. “Both candidates remained pretty dug in to their positions,” says another.
Kerry had arrived late on the night of July 10 from Beijing, diverting from his planned itinerary to Geneva for the Iran talks. Over the next three days, through long meetings, first with Abdullah’s camp, and then with Ghani’s, Kerry’s team hammered out a plan.
Afghanistan’s election commission, under international supervision, would audit every one of the eight million ballots cast in the June 14 vote (a runoff after an initial April 5 election.) The plan also called for a power-sharing arrangement that would give Abdullah an important role in the new Afghan government, potentially as a kind of deputy national leader. (The details have yet to be finalized and officials called reports of a European-style parliamentary system premature.)
A key asset in establishing the framework for the deal, officials say, was the relationship Kerry had built with the major players—Abdullah, Ghani, and also Karzai—over many years, dating to his tenure as Senate Foreign Relations Committee chairman. When Abdullah contested a fraud-rife 2009 election that returned Karzai to power, Kerry rushed to the country for long meetings with both men after a distrustful Karzai refused to talk to the U.S. special envoy to the country, Richard Holbrooke. Karzai is even less inclined to trust Washington today, and rarely speaks with President Obama. But the Afghan leader does maintain a good rapport with Kerry.
“Obviously a lot of the machinery of this took place from the White House and by phone. But ultimately a large part of why this got sealed is that Kerry had built up a relationship with Ghani, Abdullah and Karzai going all the way back to 2009,” says Jonah Blank, an Afghanistan expert with the RAND Corporation
Though the framework of the deal had been hammered out over the previous two days, the decisive moment came that Saturday evening, at the residence of U.S. Ambassador James B. Cunningham, after Abdullah and his retinue had finished prayers and broken their Ramadan fast. Ghani and his allies were elsewhere on the heavily fortified U.S. embassy compound; the two contenders for Afghanistan’s presidency had not yet met face-to-face.
Kerry had been buoyed by an earlier meeting with Karzai, who agreed to delay the country’s scheduled August 3 presidential inauguration, which a time-consuming audit of every ballot would require. But when Kerry arrived at Cunningham’s residence, Abdullah still wasn’t sold on a deal. Could he really trust an election process run by the government of Ghani’s ally Karzai?
Kerry pleaded with Abdullah to accept the deal. “I’m asking you as a friend to trust me,” he said. Kerry walked the group through several chapters in his life story, from the Vietnam War to the 2004 presidential campaign, and concluded by calling the meeting among the most important he’d ever attended. He urged Abdullah and his allies to consider the millions of Afghans who had voted despite Taliban threats—the Americans who had done so much for Afghanistan. “U.S. soldiers didn’t come here to fight and die to see this election fail,” Kerry said.
“You could tell that shifted the dynamic,” says an official who was present. Shortly after 9pm, Abdullah agreed to the deal.
Within half an hour, Ghani had arrived to clinch the agreement with his rival in person. The discourse between the Abdullah and Ghani camps had not been civil of late—at one rally, Abdullah’s running mate had called Ghani a name that roughly translates as “dried-up intestine.” But the men greeted each other warmly. If they felt personal hostility, says one official, “they did a good job of hiding it.”
As they headed to a midnight press conference, officials present say the men seemed to take pride in an agreement that had spared their country the threat of a nightmarish descent into chaos.
On July 16, President Obama opened his press conference announcing new economic sanctions against Russia by congratulating his Secretary of State for brokering the Afghan deal. Obama said it had preserved “the first democratic transfer of power in the history of that nation.”
In a conversation the day after Kerry’s departure, Ghani shared his relief over the outcome. The agreement, he said, may have saved one million Afghan lives.
More Must-Reads from TIME
- Donald Trump Is TIME's 2024 Person of the Year
- Why We Chose Trump as Person of the Year
- Is Intermittent Fasting Good or Bad for You?
- The 100 Must-Read Books of 2024
- The 20 Best Christmas TV Episodes
- Column: If Optimism Feels Ridiculous Now, Try Hope
- The Future of Climate Action Is Trade Policy
- Merle Bombardieri Is Helping People Make the Baby Decision
Contact us at letters@time.com