Correction: Earlier versions of this article about the resignation of State Department spokesman P.J. Crowley gave an incorrect age for Bradley E. Manning, the Army private who is charged in the WikiLeaks case. This version has been corrected.

Chief State Department spokesman P.J. Crowley resigned Sunday after angering the White House by calling the treatment of WikiLeaks suspect Bradley E. Manning “counterproductive and stupid.”

Crowley made the remark off-the-cuff during a presentation to a small group in Cambridge, Mass., but it quickly lit up the blogosphere. President Obama rejected the criticism Friday, saying that the Pentagon had assured him that conditions of the Army private’s confinement — which included being forced to sleep naked for a brief period — were “appropriate.”

In a statement Sunday, Crowley said: “Given the impact of my remarks, for which I take full responsibility, I have submitted my resignation.”

A retired Air Force officer, Crowley ­served on the National Security Council under President Bill Clinton before being tapped as spokesman by Secretary of State Hillary Rodham Clinton. Affable and witty, Crowley was well-regarded by reporters and became a fixture on TV screens around the world through his daily briefings.

But he was part of a State Department media operation that has undergone considerable turmoil. A State Department inspector general’s report last year said the office had problems with morale, staffing, communication and oversight. Crowley had a difficult relationship with Philippe Reines, a senior adviser to Clinton, and had less access than some of his predecessors to the nation’s top diplomat. For most of the past year, Clinton hasn’t taken a spokesman on her trips overseas.

Even before the latest controversy, Crowley had been expected to leave within months, possibly for an ambassadorship. That prospect is now out. Crowley will be replaced at least temporarily by Mike Hammer, a longtime diplomat who recently returned to State after serving as National Security Council spokesman.

Clinton said in a statement that she had accepted Crowley’s resignation with regret.

“His service to country is motivated by a deep devotion to public policy and public diplomacy, and I wish him the very best,” she said.
The remarks that led to Crowley’s ouster were made during a presentation to about 20 people on new media and diplomacy last week at the Massachusetts Institute of Technology.

One of those present asked Crowley on the record about the release of thousands of secret State Department cables by the anti-secrecy group WikiLeaks, and why the United States was “torturing a prisoner in a military brig,” according to BBC journalist Philippa Thomas, who was present.

The questioner was referring to Manning, who has been charged with providing classified documents to an unauthorized party — in other words, WikiLeaks.

Crowley said that what was being done to Manning was “ridiculous and counterproductive and stupid,” according to Thomas’s account on her blog. “Nonetheless, Bradley Manning is in the right place,” the spokesman added, according to her account.

Until making those comments, Crowley had defended the government’s handling of the WikiLeaks case and had not publicly criticized Manning’s treatment. His statement Sunday indicated that his answer to the question was not a slip, but rather his considered opinion.

His remarks in Cambridge “were intended to highlight the broader, even strategic impact of discreet actions undertaken by national security agencies every day and their impact on our global standing and leadership,” he said in his statement.

Manning, 23, has been held for eight months in pretrial detention at the Marine Corps base at Quantico, where he is under “prevention of injury watch” and confined to his cell 23 hours a day. For several nights recently, he was required to give up his prison jumpsuit and boxer shorts at night, officials say.

Military officials have said they were trying to prevent Manning from hurting himself. On Friday, officials said they are againproviding him with sleeping garments.

Manning’s attorney has asserted that his client is being punished for making a “sarcastic” comment about his detention. The United Nations special rapporteur on torture has asked U.S. officials about the case.

President Obama, asked Friday about Crowley’s statement, said he had asked the Pentagon “whether or not the procedures that have been taken in terms of his confinement are appropriate and are meeting our basic standards. They assured me that they are.”