Mr. Faqiryar made his accusations amid a growing sense of alarm in the Obama administration and in Congress over Mr. Karzai’s failure to take action against officials suspected of corruption, but also as the administration debates whether pushing too hard on corruption will alienate a government whose cooperation it needs to wage war.

Awash in American and NATO money, Mr. Karzai’s government is widely regarded as one of the most corrupt in the world. American officials believe that the corruption drives Afghans into the arms of the Taliban.

In a two hour interview at his home, Mr. Faqiryar said he and the other prosecutors in his office were demoralized by the repeated refusal of Mr. Karzai and Mr. Aloko to allow them to move against corrupt Afghan leaders.

Mr. Faqiryar said his prosecutors had opened cases on at least 25 current or former Afghan officials, including 17 members of Mr. Karzai’s cabinet, 5 provincial governors and at least 3 ambassadors. None of the cases, he said, have gone forward, and some have been blocked on orders from Mr. Karzai. He did not elaborate on each case, and it was not clear whether Mr. Aloko or Mr. Karzai were involved in all of the cases.

Mr. Karzai said he had intervened in the case of Mr. Salehi, an official on the National Security Council, because the American-backed anticorruption agencies were violating the civil rights of those they detained. He blamed foreign contractors for the corruption, and threatened to take control of the agencies, summoning the head of the one that arrested Mr. Salehi to the presidential palace for questioning.

Under intense Western pressure, Mr. Karzai appeared to back off, saying he would allow the anticorruption units to do their jobs.

Mr. Faqiryar, a 72-year-old career prosecutor, said he was fired Wednesday by Mr. Karzai after sending a midlevel prosecutor to speak about public corruption on an Afghan television station. After Mr. Karzai watched the broadcast, he called for the papers to authorize the dismissal, Mr. Faqiryar said.