WASHINGTON — President Obama says Afghanistan’s President Hamid Karzai remains “a critical partner” with the United States in the fight against terrorism despite Karzai’s recent harsh criticism of the West.

In an interview broadcast Friday, Obama said he still thinks Karzai is committed to giving his government greater legitimacy by helping its people and rooting out corruption. He said that if the United States is to ensure that Afghanistan is not a haven for extremist organizations, it must succeed on military and civilian fronts there, and Karzai has to be a major player.

“We have gotten through this period,” Gen. James Jones, Obama’s national security adviser, told reporters traveling back from Prague with the president on Air Force One.

Jones said that Obama wrote and had delivered a thank-you note to Karzai for hosting him on short notice during the U.S. president’s trip to Afghanistan. The note made no mention of the recent controversies.