KABUL, Afghanistan — With one of the most important chapters of Afghanistan’s history open before him, President Hamid Karzai took time this month for a personal meeting with the longtime foreign minister of Iraq, Hoshyar Zebari.
It had been years since an Iraqi official had been to Afghanistan, and the trip was nominally meant to ease the passage of Afghan Shiites to holy shrines in Iraq. But it came right as Mr. Karzai had chosen to dig in and delay signing a security agreement with the United States, leaving long-term Western military support, and billions of dollars in aid, hanging in the balance.
In a moment of candor, Mr. Zebari offered a piece of advice to the president that would have been unthinkable from an Iraqi official just two years ago: Get over your differences with the Americans and sign the deal.
“Don’t be under the illusion that no matter what you do the Americans are here to stay,” Mr. Zebari told Mr. Karzai. “People used to say that about the American presence in Iraq, too. But they were eager to leave, and they will be eager to leave your country as well.”
When the last American troops departed Iraq in 2011, after the collapse of a similar security agreement, many Iraqis reveled in a moment of national pride, expressing faith in the government’s ability to maintain security. Since then, the country has fallen back into hellish violence, with thousands killed in sectarian attacks this year.
The Iraqi government could not even secure Baghdad anymore, despite billions of dollars in oil revenue and well-trained security forces, Mr. Zebari told the Afghan president, according to Iraqi and Afghan officials at the meeting. So how could the Afghan government, which can barely fund 20 percent of what it spends each year, hope to control the country without American help?
The conversation was a resonant moment between two leaders at different points in their respective journeys — one pondering his country’s post-American future, the other contending with it. With the benefit of hindsight, Mr. Zebari reached out to a president he scarcely knew, seizing on their shared experience at the crossroads of American involvement in the Muslim world.
Some of the parallels for Afghanistan are clear. As impasse has deepened into crisis, some of Mr. Karzai’s closest aides have seized on Iraq as proof that the Americans could just walk away, leaving the country’s security forces without military support and training in the middle of a war against the Taliban. Billions in badly needed international aid would also probably dry up, collapsing the economy. Worries about a return to civil war in Afghanistan would leap to center stage.
But Mr. Karzai had heard it all before.
American officials, in fact, have long used the withdrawal from Iraq as a cautionary example when talking with reporters and Afghan officials about the struggle to reach an Afghan security deal. And in the days after Mr. Karzai said he would put off signing the agreement, several senior American officials warned him that they would be forced to begin considering the “zero option” — a total and final troop withdrawal in 2014 — if he did not reverse course.
And that was the way Mr. Karzai appeared to take Mr. Zebari’s words, to the chagrin of Afghan officials who had hoped their president might take heed of Iraq’s troubles.
“You see?” he told the small group of Afghan officials after the meeting ended. “The Americans want this deal so badly they are even getting the Iraqis to pressure me.”
In a telephone interview, Mr. Zebari insisted his advice had merely been an expression of good will, not water-carrying for the Americans.
“Two years after the troop withdrawal, because of the rise of violence, we went back to Washington and asked them for continued support and military help,” he said, referring to a Nov. 1 trip by the Iraqi prime minister, Nuri Kamal al-Maliki, after a huge surge in attacks by Al Qaeda in Iraq and other Sunni militants. “One should really draw from that conclusion.”
In 2011, the deal effectively broke down over Iraqi domestic politics. But within Mr. Karzai’s response to Mr. Zebari’s plea lies one of the core reasons it might yet happen that the United States leaves Afghanistan outright, too, despite urgency within parts of the Obama administration not to see a decade of lost lives and treasure blown away.
Facing a world of potential consequences, Mr. Karzai again seemingly reduced the moment to himself. And whether out of paranoia or justifiable suspicion, his reaction has increasingly been to express profound distrust for his American allies.
“Even if they are not bluffing, we will not give in to the pressure to sign if our requirements are not fulfilled,” he told the French newspaper, Le Monde last week. “What I am hearing these days, and what I have already heard, is typical of colonial exploitation.”
Trying to understand Mr. Karzai’s intentions has become something of a parlor game in Kabul and Washington over the last few weeks. Has the bitterness over a failed 12-year war against the Taliban, and fear that the Americans will betray him, made him feel he must finally take a stand? Is he, as he says, using brinkmanship to ensure the best possible deal for Afghans, as he has with greater frequency in recent years?
“It might be a political game he’s playing, it might be for the sake of the nation or for his personal interests,” said Mohammad Homayoon Shinwari, an adviser to the president. “Politics is always what happens behind the curtain.”
In any case, the specter of Iraq has not just been used as a threat. It has loomed over every step of the debate on a long-term troop presence, both inside the White House and the Afghan presidential palace.
For the Americans who want to see troops stay on, the Iraqi example has served as a fallback position. “You can point to what’s been happening in Iraq, and you can say, ‘We can’t allow that to happen in Afghanistan,’ ” one senior administration official said.
Those in favor of a total withdrawal have a sense of having avoided a debacle in Iraq — that leaving incurred almost no political cost at home and most likely saved American lives. The same would be true in Afghanistan, another American official said.
Still, even those relieved at having avoided catastrophe in Iraq are reluctant to see Afghanistan descend into bloodshed.
The outcome of a grand assembly of Afghan leaders last month, the loya jirga, was an expression of urgency to seal a security deal, just one indicator that at least some of the Afghan public wants continuing American support. And American officials do not want to “punish the Afghan people” because of Mr. Karzai’s intransigence, the senior administration official said.
The officials asked not to be identified because they were describing internal discussions and delicate negotiations.
Within the Afghan government, Mr. Karzai’s stance has started to create a sense that he is on the fringe.
Even his most senior cabinet officials, including the ministers of defense and the interior, had no idea he planned to insist on delaying the deal and push for better terms until the words had left his mouth, during a speech before the loya jirga on Nov. 21 that left the audience, and other officials, shocked, according to a range of Afghan officials.
Some officials even suspect Mr. Karzai had not planned to, either: They say the words had not appeared in any drafts of the speech.
Matthew Rosenberg contributed reporting from Washington.