Obama had summoned McChrystal from Afghanistan to answer for remarks he and his aides made in an explosive Rolling Stone magazine article that disparaged the president and other civilian leaders.
The conduct represented in the recently published article does not meet the standard that should be set by a commanding general, Obama said bluntly in the White House Rose Garden as he announced McChrystals dismissal.
It undermines the civilian control of the military that is at the core of our democratic system. And it erodes the trust thats necessary for our team to work together to achieve our objectives in Afghanistan, he said.
The situation posed a dilemma for Obama. If McChrystal had kept his job, the president could have been seen as tolerating insubordination. By firing him, Obama opted instead for the risk involved in shaking up the chain of command at a perilous moment in the unpopular nine-year-old war.
Obama said McChrystals dismissal was needed to safeguard the unity of the war effort but insisted the switch in generals was a change in personnel but it is not a change in policy.
There have been increasing doubts among U.S. lawmakers about Obamas six-month-old troop buildup strategy against a resurgent Taliban, and some critics are skeptical of Obamas pledge to start bringing U.S. forces home by July 2011.
Seeking to underscore the continuity of command and counter any concerns about a disruption in war leadership, Obama had Petraeus by his side for the announcement.
Petraeus, as commander of U.S. forces in Iraq, was widely credited with turning the tide when sectarian violence there verged on civil war. He has a strong following on Capitol Hill and swift Senate confirmation is expected.
Afghan President Hamid Karzai, who has a close bond with McChrystal and had hoped he would stay on, respected Obamas decision to dismiss him, a spokesman said.
Obama spoke to Karzai and British Prime Minister David Cameron, a key ally in Afghanistan, about the change.
The episode evoked memories of military-civilian tensions when President Harry Truman summoned General Douglas MacArthur for a dressing-down and stripped him of his Far East command in 1951 for flouting U.S. policy and openly advocating expansion of the Korean conflict to China.
McChrystal, the U.S. and NATO commander in Afghanistan and an architect of Obamas war strategy, entered the White House through a side door for his encounter with Obama, who accepted his letter of resignation during a 30-minute meeting.
Underscoring Obamas displeasure over the McChrystal incident, he then delivered a stern lecture to his national security team, ordering them to stop petty bickering and forge unity, a senior administration official.
Aides had described Obama as furious about McChrystals contemptuous remarks in the article, but he said in his Rose Garden appearance he was not acting out of a feeling of personal insult.
With his career on the line, the 55-year-old general had apologized on Tuesday, calling it a mistake reflecting poor judgment.
As Obama was speaking, McChrystal released a terse statement saying he had resigned out of a desire to see the mission succeed.
Lieutenant-General David Rodriguez, McChrystals No. 2, was named acting commander of U.S. forces in Afghanistan, and British Lieutenant-General Nick Parker will serve as acting head of NATO forces in Afghanistan until Petraeus takes over, U.S. officials said.
In the article entitled The Runaway Generalhere — McChrystal himself makes belittling remarks about Vice President Joe Biden and the U.S. special envoy to Afghanistan and Pakistan, Richard Holbrooke.
His aides are quoted as calling Obama national security adviser Jim Jones a clown and saying the president appeared intimidated and disengaged at an early meeting with McChrystal.
Afghanistan had slipped down Obamas policy agenda recently as he focused on domestic challenges like high unemployment and the devastating BP Plc oil spill, seen as critical to avoiding big losses for his Democratic Party in Novembers congressional elections.
But the furor surrounding McChrystal comes amid growing skepticism in Congress and declining support among the public for the war in Afghanistan, where Taliban violence has risen despite a troop increase ordered by Obama six months ago to bring U.S. forces up to 100,000.
Petraeus confirmation hearing could be as early as Monday in the Senate Armed Services Committee, said the panels chairman, Democrat Carl Levin. He said he expected the full Senate to act on the nomination by July 4.
Additional reporting by Phil Stewart, Jeff Mason, Patricia Zengerle, David Alexander, Susan Cornwell, Tabassum Zakaria Editing by Patricia Wilson and Mohammad Zargham source