Ousting the ministers could also complicate relations with the United States. American officials value their longstanding collaboration in particular with Mr. Wardak, who is seen as a stable ally compared with the mercurial Mr. Karzai. In addition, both ministers have long experience in fighting the insurgency.

“Even if this is only a political gesture and current ministers stay, this is a warning about the weakness of the Karzai government, a reflection of the deep divisions in the Afghan legislature and an indication of the kind of far deeper ethnic and sectarian splits that may come as the transition proceeds,” said Anthony Cordesman, an expert on the war at the Center for Strategic and International Studies in Washington. “Transition is already a high-risk effort, and this kind of additional risk is scarcely likely to make things better.”

The vote could be a harbinger of a broader shake-up in the government. At least two other important ministers, including Finance Minister Omar Zakhilwal, are already under scrutiny. With the disclosure last week of bank statements showing transfers from Afghan businesses into his accounts, Mr. Zakhilwal is facing questions about corruption from a government antigraft agency. (He says the money was for earlier consultancy work.)

The American Embassy and the NATO command here appeared to be caught by surprise by the parliamentary vote and did not comment, leaving unclear what effect it might have on an increasingly complex security transition. American and international forces have been turning over province after province to Afghan control, razing their bases or giving them to the Afghans in a delicately choreographed sequence meant to ensure the Afghans have enough help in the near term as they take up the fight against a diminished but still persistent Taliban presence.

The vote came as many Afghan leaders and civilians are increasingly frustrated with corruption that undermines attempts to rebuild after years of war and amid anger from Parliament about cronyism in both ministries and accusations of ethnic bias in the Interior Ministry. Mr. Wardak has been accused of directing lucrative NATO trucking contracts to his son, a charge he has denied, while Mr. Mohammadi is seen as favoring fellow Tajiks from northern Afghanistan.