BAGRAM, Afghanistan — On Thursday at 9:10 a.m., the gates of the Bagram Prison swung open, and 65 men with long beards and new clothes walked out to freedom. The moment showed clearly just how thoroughly President Hamid Karzai had broken with the American military, here now 12 years.

American officials had lobbied intensely with the Afghan government, first in private and then in increasingly acrimonious terms in public, to prevent the release of men they believed were not only dangerous insurgents with American and Afghan blood on their hands, but also men who would be convicted of that in an Afghan court of law.

Instead, American soldiers on duty at Bagram could do nothing more than watch on closed-circuit television monitors as Afghan military police used Ford pickup trucks to ferry the prisoners to the nearest bazaar to catch taxis, saving them a mile-and-a-half walk. Prison authorities had given each man, in addition to clothes, warm coats and 5,000 afghanis, or about $90 — nearly half the base monthly salary of an Afghan police officer.

Mr. Karzai, on a visit to Turkey with his defense minister, Bismullah Khan, was unmoved by American cries of foul. “If Afghan judiciary authorities decide to release prisoners, it’s of no concern to the U.S.,” he said, according to a Twitter message from his spokesman, Aimal Faizi.