US state department spokesman PJ Crowley has resigned after calling the treatment of the man accused of leaking secret cables to Wikileaks "stupid".
He said he was taking responsibility for the impact of his remarks about Bradley Manning.
Private Manning is being held in solitary confinement at a maximum security US military jail.
He has been on suicide watch at the Quantico marine base in Virginia and is shackled at all times.
He faces 34 charges relating to the leaking of 720,000 diplomatic and military documents.
Secretary of State Hillary Clinton said she accepted Mr Crowley's resignation "with regret".
She said he had served his nation "with distinction", "motivated by a deep devotion to public policy and public diplomacy".
Mr Crowley was speaking to an audience at the Massachusetts Institute of Technology about new media and foreign policy when he made the controversial remarks.
He was asked by a participant about the "the elephant in the room" - Wikileaks - and, in the questioner's words, "torturing a prisoner in a military brig".
"I spent 26 years in the air force," Mr Crowley reportedly replied.
"What is happening to Manning is ridiculous, counterproductive and stupid, and I don't know why the DoD [Department of Defense] is doing it. Nevertheless, Manning is in the right place."
He said his comments were on the record, though he later added that they were his own opinion.
In his resignation letter he said: "Given the impact of my remarks, for which I take full responsibility, I have submitted my resignation."
His remarks were revealed in a blog by the BBC's Philippa Thomas, who attended the event.
President Barack Obama later insisted he had received assurances that the terms of Pte Manning's confinement were "appropriate".
Earlier this year, rights organisation Amnesty International expressed concern about the conditions in which Mr Manning was being held.
It said he had been held "for 23 hours a day in a sparsely furnished solitary cell and deprived of a pillow, sheets, and personal possessions since July 2010".
He was also reportedly forced to disrobe on a daily basis.