The Afghan President went on a tirade supposedly about how the Taliban were virtually in collusion with the U.S. — just in time for the first visit by the new U.S. Secretary of Defense

Erin A. Kirk-Cuomo / U.S. Department of Defense U.S. Secretary of Defense Chuck Hagel, center, meets with Afghan President Hamid Karzai, left, in Kabul on March 10, 2013

If Chuck Hagel had hoped to have a smooth first visit to Afghanistan as the newly minted U.S. Secretary of Defense, he should have known better. Hamid Karzai has a long memory — and the Afghan President is known to hold grudges.

This is what Karzai would have remembered Hagel saying to him 10 years ago. “If you leave an impression that everything is going well … the next time you come back, your credibility will be in question,” then Senator Hagel told the visiting Afghan leader at the end of an embarrassing grilling at the Senate Foreign Relations Committee in 2003. Sitting heads of state usually don’t testify to the U.S. Senate — the testimony occurred because of a mistake by Karzai’s ambassador to Washington. President George W. Bush issued a public apology to Karzai over his treatment. Karzai then fired the ambassador.

Ten years later, it is a crucial time of transition for Afghanistan, with Karzai preoccupied with his legacy. Who should show up but Hagel. And the Afghan President has apparently returned the favor he received in Washington a decade ago. Ahead of their talks, Karzai went on another of his now usual anti-U.S. tirades. He accused the Americans of double-speak, bordering on collusion with the Taliban. “The Taliban talk to the United States every day, but they detonate bombs in Kabul and Khost to show their force to the Americans,” Karzai said. “No, these bombs that went off in Khost and Kabul yesterday, this wasn’t showing force to America … in reality, it was a service to the foreigners so their presence remains in Afghanistan.”

(MORE: Karzai Calls on Afghan Troops to Clean Up Own Act)

A presidential-palace official clarified later that Karzai’s comment was targeted at the Taliban for prolonging violence — and not at the U.S., as understood by many reporters. Of course, the Afghan President has a history of tirades — and making life tough for recently appointed U.S. officials on their first visit to Afghanistan. He did it to Richard Holbrooke — Obama’s special adviser for Afghanistan — and to General David Petraeus after he took over as commander of U.S. forces in Afghanistan from General Stanley McChrystal, perhaps Karzai’s favorite military man of the past 10 years. In the first meeting between Karzai and Petraeus, the discussion got heated when the U.S. general pushed hard for launching the Afghan local police, a semiofficial militia to fill the security void in volatile areas.

Some who have known Karzai for years have come to believe the Afghan President actually derives pleasure from his tirades. “It’s almost as if he walks into the office in the morning hoping for material to chide the U.S. over — he would be disappointed otherwise,” a former official said. According to the official, Karzai remembers being ignored by State Department desk officers when he was a lowly political campaigner against the Taliban in the late 1990s. As a result, he enjoys hassling them now.

Karzai had other potential reasons for tweaking the Americans: two missed deadlines that have humiliated him. The first was for the transfer of a major U.S.-controlled prison to the Afghan government; the second, the pullout of U.S. Special Forces out of eastern Wardak province. In January last year, Karzai demanded the main prison in Parwan be handed over to his government within a month (despite his national security team in private expressing concern about their capacity to take in the prisoners). It’s been over a year since the deadline passed. Last week, despite Karzai’s announcement in parliament that the handover was imminent, the transfer scheduled for Saturday was canceled at the last minute. The President was not pleased.

Meanwhile, Karzai last month gave the U.S. Special Forces in Wardak two weeks to pull out after reports emerged of abuses by elements associated with the Americans there. That deadline also passed on March 11 with no indication of a U.S. withdrawal from the province. “By demanding the U.S. Special Forces pull out of Wardak, Karzai is essentially putting a huge question mark on the nature of the U.S. presence after 2014,” a former senior official said. It is widely believed that the Special Forces are central to how the U.S. envisions its long-term presence in Afghanistan — a light footprint, relying on small strike forces to go after terrorist cells. By publicly threatening to derail U.S. post-2014 plans, Karzai is in fact bargaining for more authority over the fate of the upcoming elections and, by extension, the political future of the country.

(PHOTOS: America’s Long Withdrawal from Afghanistan)

He is also playing on Afghan public sentiment. Many of his countrymen believe that the U.S. and other foreigners will never really leave Afghanistan because they want to exploit the country’s mineral resources. In the same speech in which he virtually equated the U.S. and the Taliban, Karzai hammered the point, in case people missed it. Said the Afghan President: “Some countries — including the United States — have already written that … since you and I are allies, I want such and such of your underground resources, you shouldn’t give it to anyone else.”

The tirades have often been a tactical move by Karzai to pressure Washington during tough negotiations, according to officials and analysts. However, they have not paid off all the time. Indeed, the shrillness may also be evidence of Karzai’s paranoia over the divergence between the U.S. civilian and military approaches toward the Taliban. A faction in the Obama Administration apparently advocates keeping the door open to a settlement with the Taliban. But, says a U.S. official privy to the discussion around the peace talks, “our military is in the business of fighting them while we work on the political settlement.” Any settlement between the U.S. and the Taliban, without Karzai and his 10-year-old administration taking the lead, would severely affect the President’s legacy. He is particularly concerned about that with his final constitutional term running out in about a year.

Many sources close to the Afghan President say he genuinely believes the Americans are following a “hidden agenda” in the region — and that he is out of the information loop. “The United States says the Taliban is not my enemy and I don’t have any war against them, but they harass people in our country in the name of the Taliban every day,” he said in the speech. “We are aware … the foreigners as well as the patriots among the Taliban come to us and inform us that there is a deal in the making among [Taliban] leaders and the Americans. Be careful. In Europe and Gulf countries, there are talks between Taliban and the foreigners.”

The U.S. official is adamant there have been no direct talks with the Taliban since January 2012. He says some European and Arab countries, as well as other “freelance” intermediaries, meet with Taliban representatives in Doha and pass messages.

There is no guarantee that the tirades will lead to the prison being handed over or the Special Forces pulling out of Wardak. In the end, it may simply be the Afghan President trying to recast his position to ensure his public standing — and the longevity of his legacy, whatever it is in the end. “Karzai’s slogans sounded just like the Taliban’s,” a former senior official in the Karzai government said about the speech. “The Taliban also say the foreigners are invaders, barging into people’s homes in the middle of the night. The Taliban also say the foreigners are here to [exploit] the mineral wealth. By bringing his message closer to the Taliban’s, Karzai hopes to do away with their justification for their war.” For now, the Afghan President had better hope that Secretary of Defense Hagel does not have a long memory — or hold grudges.