KABUL, Afghanistan — In his nearly 13 years as the leader of Afghanistan, Hamid Karzai’s most memorable public stances always seemed driven by some deep emotion, and an almost compulsive need to express it. There was heartbreak for families killed by errant airstrikes, outrage at the scheming of hostile neighbors, palpable longing to preside over a peaceful end to the Taliban insurgency.

On Tuesday, though he delivered a farewell speech in a loose and sometimes jocular way, there was, again, no doubt of the emotion that inspired his words: bitterness at what he saw as an American betrayal of Afghanistan.

“America did not want peace for Afghanistan, because it had its own agendas and goals here,” he told an audience of hundreds of cabinet and staff members at the presidential palace in Kabul, warning them not to trust the Americans. “I have always said this: that if America and Pakistan want peace, it is possible to bring peace to Afghanistan.”

Mr. Karzai’s denunciation of the United States came in terms that had become wearily familiar to the diplomats watching the televised speech from the heavily fortified American Embassy just a few blocks and many blast walls from the palace. But what the president did not say, omitting any recognition of the more than 2,000 American lives and hundreds of billions of dollars the United States expended in fighting the Taliban, may have grated more.