Afghan President Hamid Karzai needed high-level American arm-twisting over several tense days — and meals that included "gallons of tea" and endless platters of lamb — before he finally agreed Tuesday to a run-off vote in the country's fraud-plagued presidential election.

A senior American official briefed on the meetings by Sen. John Kerry gave The Associated Press details of the negotiations with Karzai, talks that lasted late into several nights and went on for hours each day.

They began on Friday and continued through late Tuesday afternoon, hours beyond the scheduled start of a news conference at which Karzai was to have announced his agreement to a second-round ballot.

SLIDESHOW: Presidential Runoff Ordered

President Barack Obama singled out the work of Kerry, the chairman of the Senate Foreign Relations Committee, and Ambassador Karl Eikenberry, who, the president said, "have been working tirelessly throughout this process."

Kerry "was in the region traveling and ended up working extensively with Ambassador Eikenberry and was extraordinarily constructive and very helpful. So I think he deserves great congratulations," Obama said during a brief meeting with reporters after an Oval Office visit with Iraqi Prime Minister Nouri al-Maliki.

Back in Kabul, the official, who spoke anonymously to provide details of the private talks, said Karzai had become "shaky" and was suffering "buyer's remorse" by noon Tuesday. That was shortly before the news conference in which he was to announce his agreement to the run-off. He needed several more hours of convincing, including a long walk with Kerry on the Presidential Palace grounds.

During the extended stroll, the official said, Kerry opened up to Karzai, telling him about his own difficult decision as the Democratic presidential candidate not to challenge the vote count in Ohio on election night in 2004. There were allegations of voting irregularities in favor of incumbent President George W. Bush, and Kerry told Karzai that he knew he could have held up a final outcome for weeks by filing a challenge.

The official said Kerry told Karzai that he had decided then that a challenge was "not in the interests of an already divided and politically weary country."

Kerry first got word Friday that Karzai was balking at holding a new vote and refusing to accept the U.N. voting commission's finding of fraud. Kerry was at dinner in Kabul with troops from his home state of Massachusetts. Eikenberry alerted the senator to the brewing crisis and the two went unannounced to the Presidential Palace for a nighttime meeting that lasted several hours.

The interlocutors agreed that Kerry would return to the place Saturday afternoon, scrubbing the senator's plans to travel to Jalalabad in eastern Afghanistan and on to Pakistan.

LIVESHOTS: Afghan Election Panel Throws Out Ballots

On Saturday morning, Kerry met with former Foreign Minister Abdullah Abdullah, Karzai's main challenger and the only candidate who will face the Afghan leader on the next ballot. He also saw U.N. chief of mission Kai Eide, Eikenberry, the British and French ambassadors and French Foreign Minister Bernard Kouchner. There also was a sitdown with the former U.S. ambassador to Iraq, Zalmay Khalilzad, who was born in Afghanistan and meeting with Karzai to encourage him to sign on to a new vote.

Meetings between Kerry, Eikenberry and Karzai continued throughout the day and late into the night Saturday. There was progress but no agreement, with Karzai insisting the 1.3 million ballots stripped from his total, leaving him at 48 percent, was unfair and had disenfranchised his supporters.

Senior White House officials, who also spoke on condition of anonymity to offer details of the negotiations, said Kerry stayed in Eikenberry's residence in Kabul and conducted his work from the U.S. Embassy, where he stayed in close telephone contact with Secretary of State Hillary Rodham Clinton, national security adviser James Jones and special Afghan envoy Richard Holbrooke.

Sunday morning, Kerry flew south to Kandahar to visit a U.S. air base and then to Marine Camp Leatherneck to meet troops and receive a briefing. He also visited a tribal shura or council and gave remarks. He and Eikenberry returned to Kabul for more talks with Karzai who "was not in a positive frame of mind." After several hours of meetings that included both Afghan and U.N. election officials, Kerry felt there had been progress but no resolution. He decided he would pick up his schedule and go to Pakistan, with plans to return to Kabul if needed.

On Monday in Pakistan, Kerry had breakfast with Gen. David Petraeus, the chief of the U.S. Central Command, and meetings with Pakistani officials. He then returned to Kabul, hoping to close the deal with Karzai. An agreement was reached late in the day Monday and Karzai agreed to make the announcement Tuesday afternoon at a news conference.

But then at noon Tuesday Karzai got cold feet and needed convincing yet again. That's when he and Kerry took their long walk through the grounds of the Presidential Palace. Karzai visited a small mosque on the compound to clear his head.

Then — at 4:50 p.m. Kabul time — Kerry, Karzai and Eikenberry and a large gathering of officials walked back into the palace to face reporters.

The deal was finally done.