KANDAHAR, Afghanistan — The 29-year-old engineering student was standing outside his classroom here on Saturday morning when he said two pickup trucks full of armed men pulled up. The men, said to be members of a C.I.A.-backed Afghan strike force, grabbed him, tied his hands behind his back, draped a black hood over his head and drove him to an undisclosed location where, the student says, he was beaten and whipped.

The student’s daylong detention was cited by President Hamid Karzai of Afghanistan at a news conference in Kabul, the capital, on Sunday as part of his justification for a ban announced later in the day on foreign forces from entering any Afghan school or university. He said other students had also been detained at the behest of American-controlled Afghan forces.

The complaint was part of barrage of public criticism that Mr. Karzai leveled at his American military allies during a visit to Afghanistan by the new defense secretary, Chuck Hagel.

The details of the episode were confirmed by Afghan officials here and in an interview with the student on Sunday, but they have not been confirmed or denied by the United States.