Diplomacy and U.S. arm-twisting helped secure a power-sharing agreement between rival Afghan presidential candidates, Ashraf Ghani, right, and Afghan rival presidential candidates Abdullah Abdullah. (Omar Sobhani/Reuters)

In his long history of personal diplomacy in Afghanistan, Secretary of State John F. Kerry has repeatedly returned to his concession to George W. Bush in the 2004 presidential race, made amid Democratic allegations of Republican dirty tricks and voter suppression.

“It was hard to do and many of my people were mad at me,” Kerry told Afghan presidential candidate Abdullah Abdullah last week, in a last-ditch effort to persuade him to accept a power-sharing arrangement under the presidency of his opponent, Ashraf Ghani . “But it was the right thing to do for the country,” Kerry said, according to a partial transcript of the conversation, which was provided by U.S. officials.

In 2009, while on a mission for President Obama, Kerry, then a senator, made the same case to Abdullah and Afghan President Hamid Karzai when the incumbent refused to submit to a runoff between them and both sides charged fraud. Then, as now, Kerry reflected on the heartbreak of loss. Then, as now, he warned that the United States would find it difficult to continue supporting Afghanistan if an agreement could not be reached.

Then, as now, Abdullah yielded.

In the wake of Sunday’s announcement that Abdullah would serve in the newly created post of chief executive in a Ghani administration, there are lingering doubts in both countries about the viability of their partnership.

Arriving for his victory speech Monday in a school gymnasium not far from the presidential palace in Kabul, Ghani had already assumed presidential-style security. As supporters cheered, he walked to the front of the hall preceded by girls in colorful Afghan dresses tossing rose petals. A two-story-high banner on the wall featured his photograph.

Abdullah and his supporters were absent from the celebration and the banner. An aide said Abdullah was traveling outside the capital on personal business.

But Ghani, in a 30-minute speech televised nationwide, repeatedly pledged to make the alliance work. “Peace is our demand and, God willing, it will come,” he said. “I and Dr. Abdullah are committed to the commitments we have made before the people.”

While many Ghani supporters at the event said the country was ready to put aside the protracted election dispute and rally behind both the new president and Abdullah, some remained skeptical.

“I assure you, they cannot move forward because the differences are like the colors white and black,” said Mir Mohammad Hassan Sharza, chairman of the National Peace and Islamic Party of the Tribes of Afghanistan, which backed Ghani in the election.

Hassan said he feared that the new government may only embolden the Taliban, given broad public doubts about whether Ghani and Abdullah can avoid a future conflict. “The enemy is at the gate,” he said. “So if they don’t work well with each other and this disintegrates, it will be a huge opportunity” for the militants.

The Taliban dismissed the unity government as a U.S.-created “sham.” In a statement e-mailed to reporters Monday, Taliban spokesman Zabihullah Mujahid vowed to “continue our jihad until we free our nation from occupation and until we pave the way for a pure Islamic government.”

Whatever doubts the Obama administration may have, senior U.S. officials were content Monday to bask in the glow of success. Immediately after the presidential inauguration, tentatively scheduled for Sept. 29, Ghani is expected to sign the bilateral security agreement that will allow nearly 10,000 U.S. troops to remain in Afghanistan after December’s scheduled withdrawal of all combat forces.

Throughout the tense months of vote counting and negotiations following a June runoff that both candidates claimed to have won, the Obama administration repeatedly insisted that its pushing and prodding were merely advisory and that the decision was up to Afghans.

But in the wake of the new agreement, officials were eager — at least on the condition of anonymity — to signal that the administration had done far more than it had publicly revealed.

While the White House had announced only three calls to each of the candidates since mid-June, Obama had actually made seven calls to Abdullah and six to Ghani, senior administration officials said.

Kerry more than doubled the ante, placing 13 calls to Ghani, 14 to Abdullah and three to Karzai. During the calls and two visits to Kabul, Kerry “followed a course of personal diplomacy and team work that pulled Afghanistan’s political process back from the brink and opened the path to agreement,” a senior aide wrote in a lengthy play-by-play document produced to mark the occasion and made available by the administration.

In his multiple contacts, as he “managed to keep Karzai on the reservation” and told Ghani and Abdullah that the alternative to agreement was chaos and more war, “there was never a point where Kerry threatened,” the aide wrote. “Rather, he cajoled and persuaded.”

But a partial transcript of Kerry’s 40-minute video conference call with Abdullah and more than 30 members of the candidate’s leadership council Wednesday included a clear promise that was all but a threat.

“If you don’t come to an agreement now, today, the possibilities for Afghanistan will become very difficult, if not dangerous,” Kerry told them, according to the partial transcript. “I really need to emphasize to you that if you do not have an agreement, if you do not move to a unity government, the United States will not be able to support Afghanistan.”

In addition to the U.S. troops, that warning presumably included up to $8 billion in annual security and economic support the United States has promised Afghanistan for the next decade.

In closing, Kerry said that he had served as a soldier in wartime and as a politician in a divided government. “I can promise you, no matter how difficult it is to be a politician in that kind of government,” he said, “you know better than I do how much worse war is.”

Craig reported from Kabul.