State Department spokesman P.J. Crowley is out of a job after criticizing the Pentagon last week for its detention of a private accused of feeding hundreds of thousands of documents to WikiLeaks.

Crowley resigned Sunday after also recently angering the White House for comments that he made during the height of the Egyptian crisis that forced President Hosni Mubarak to step down.

Secretary of State Hillary Clinton issued a statement saying, "It is with regret that I have accepted the resignation of Philip J. Crowley as assistant secretary of state for public affairs. P.J. has served our nation with distinction for more than three decades, in uniform and as a civilian. His service to country is motivated by a deep devotion to public policy and public diplomacy, and I wish him the very best."

Crowley also issued a statement acknowledging his remarks about Manning.

"The unauthorized disclosure of classified information is a serious crime under U.S. law. My recent comments regarding the conditions of the pre-trial detention of Private First Class Bradley Manning 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.

"The exercise of power in today's challenging times and relentless media environment must be prudent and consistent with our laws and values. Given the impact of my remarks, for which I take full responsibility, I have submitted my resignation," he said.

Last week, Crowley attended an MIT event on social networking, Twitter and the Arab revolution and reportedly was asked by a guest in the audience about WikiLeaks and the "torturing" of a prisoner in a military brig.

According to blogger Phillipa Thomas, Crowley replied without pause that what's being done to Manning by military officials "is ridiculous and counterproductive and stupid."

"Nonetheless, Bradley Manning is in the right place," Thomas blogged Crowley as saying.

Asked about the exchange, Defense Department spokesman Col. Dave Lapan told Fox News on Saturday that it had set the record straight with the State Department press secretary.

"We have since sent him the facts about Manning's confinement. We also understand from the State Department that he has said the comments were his personal opinion and not reflective of the government," Lapan said.

President Obama also did not come to Crowley's defense during a press conference on Friday.

"With respect to Private Manning, I have actually 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 assure me that they are. I can't go into details about some of their concerns, but some of this has to do with Private Manning's safety as well," the president said.

However, the president's reticence may be the result of Crowley recently going beyond Obama's statements during the critical days of the Egyptian crisis. After Mubarak spoke on Egyptian national television, Crowley tweeted that it wouldn't be enough to "reshuffle the deck chairs."

Sources told Fox News that Crowley's Tweet was not approved in advance from the White House communications team and it did not appreciate his making that remark.

But the statement on Manning may have sped up any pending departure by Crowley.

Manning's lawyer has filed complaints arguing that his client should not be in solitary confinement or on maximum detainee and prevention-of-injury status while being held in the brig at the Marine Base in Quantico, Va.

At least twice, Manning has been made to stand at attention in the nude at the front of his cell in the morning. Officials at Quantico declined to explain those measures, other than to say it was for his own protection.

On Friday, David House, a spokesman with the Bradley Manning Advocacy Fund, noted Crowley's assessment in defending the private.

"There is no justification for Bradley's inhumane treatment. I agree with Mr. Crowley that it’s just stupid and unproductive."

Deputy Assistant Secretary Michael Hammer, who moved to the State Department a few weeks ago from the National Security Council, will serve as acting spokesman in Crowley's place. Hammer may also be nominated to replace Crowley, a position that needs Senate confirmation.

Fox News' James Rosen and Justin Fishel contributed to this report.