President Hamid Karzai of Afghanistan has been America’s faithless partner throughout the war. Despite corruption in his government and his own family, Washington has worked with him to hold the country together because it has had to.

It’s hard to be shocked now by Mr. Karzai’s duplicity. But last weekend, Mr. Karzai showed a truly sinister side in accusing the United States of colluding with the Taliban on suicide attacks to keep Afghanistan unstable and to give forces an excuse to stay beyond the troop withdrawal deadline, at the end of 2014. Then on Tuesday he suggested his government might unilaterally act to take control of Bagram Prison if the United States delayed handing it over. This came after weeks of tension over his other anti-American statements, and acts like banning Special Operations forces from Wardak Province.

Analysts say he is making inflammatory comments to improve his domestic political image by appealing to Afghan nationalism as the United States withdraws its forces from Afghanistan. But his statements have been so irresponsible and dangerous that the American commander in Afghanistan, Gen. Joseph Dunford Jr., warned his forces on Wednesday to intensify security measures because they were at greater risk of attack by Afghan security forces and militants.

Mr. Karzai’s efforts to vilify Americans is outrageous, since Washington is supporting an Afghan-led process that has the potential to reach some kind of peace agreement with the Taliban. Several influential Afghans, including both vice presidents and representatives of 14 political parties, were so appalled by Mr. Karzai’s latest comments that they called a news conference to denounce them. Members of Congress who have been strong supporters of Mr. Karzai and the Afghan war are also outraged.