General Stanley McChrystal has been relieved of his command of US and Nato forces in Afghanistan.
McChrystal's departure follows a 30-minute meeting with Barack Obama, the US president, on Wednesday.
He had been summoned to Washington after a Rolling Stone magazine article portrayed the general and his aides as dismissive of the Obama administration and its strategy in Afghanistan.
Obama nominated General David Petraeus, the head of US Central Command, to take command of the war in Afghanistan.
In a statement in the Rose Garden at the White House on Wednesday afternoon, Obama said he was not "personally insulted" by McChrystal's comments, but called his conduct unbecoming.
"The conduct represented in the recently published article does not meet the standard that should be set by a commanding general," Obama said.
"It undermines the civilian control of the military that is at the core of our democratic system."
No change to strategy
Obama made it clear that the change in command would not mean significant changes to his war strategy in Afghanistan.
Al Jazeera's Patty Culhane reports on General David Petraeus, McChrystal's successor
He sent 30,000 new troops this year, many of whom are engaged in trying to secure Afghanistan's volatile southern promises, and plans to begin withdrawing troops next summer.
"This is a change in personnel, not a change in policy," he said.
Al Jazeera's James Bays, in the capital Kabul, said that behind the scenes the Obama administration knows that Petraeus has a very difficult task.
"He has been looking at this war from afar, but right now at the height of the battle he has got to take over on the ground.
"This month in June the number of international troops killed as we count them stands at 79. That makes this the deadliest month in terms of American and other Nato troops killed at any point in this war which has lasted almost nine years."
McChrystal emailed a short statement to reporters shortly after Obama's announcement, calling it a "privilege and honour" to have served as the US and Nato commander in Afghanistan.
"I strongly support the president's strategy in Afghanistan, and am deeply committed to our coalition forces, our partner nations and the Afghan people," he wrote.
"It was out of respect for this commitment that I tendered my resignation."
The Rolling Stone article, released on the internet on Tuesday, contained quotes critical of Joseph Biden, the US vice-president, and several other high-ranking officials.
At one point, McChrystal referred to a leaked memo from Karl Eikenberry, the US ambassador in Kabul, which questioned the competence of the Afghan government.
Michael Hastings, author of the Rolling Stone article, talks to Al Jazeera about McChrystal
"Here's one that covers his flank for the history books," McChrystal said. "Now if we fail, they can say, 'I told you so.'"
McChrystal had already apologised for his remarks.
In a statement released on Tuesday, he called his comments "a mistake reflecting poor judgment".
A spokesman for Nato, James Appathurai, told Al Jazeera on Tuesday that the military alliance still had "full confidence" in McChrystal.
The Afghan government also took the unusual step of endorsing McChrystal and urging Obama not to remove him from command.
Waheed Omer, a spokesman for Afghan president Hamid Karzai, said Karzai "respects" the decision.
"We had hoped this would not have happened, but the decision has been made and we respect it," Omer said. "[Karzai] looks forward to working with his replacement."
The change of command is the latest bit of bad news in a difficult month for the Nato mission in Afghanistan. Six Nato soldiers were killed in attacks across the country on Wednesday, bringing the death toll for foreign troops in June to 75.