Washington (CNN) -- President Barack Obama on Wednesday replaced Gen. Stanley McChrystal as commander of U.S. and allied forces in Afghanistan and nominated Gen. David Petraeus to replace him while affirming support for a counterinsurgency strategy encountering problems.

The dramatic shift came a day after McChrystal's disparaging comments about America's civilian leadership surfaced, and reignited the national debate on the war in Afghanistan -- now in its eighth year with a June death toll of coalition forces that is close to becoming the highest of the war.

Obama accepted McChrystal's resignation "with considerable regret" and named Petraeus, the head of the U.S. Central Command, to take over pending Senate confirmation.

"It is the right thing for our mission in Afghanistan, for our military and for our country," Obama said outside the White House, flanked by top civilian and military leaders including Vice President Joe Biden; Adm. Mike Mullen, chairman of the Joint Chiefs of Staff; Defense Secretary Robert Gates, and Petraeus.

McChrystal's remarks in a Rolling Stone article undermined the civilian control of the military "at the core of our democratic system," Obama said, noting the decision to replace the general did not involve any disagreement over strategy or personal issues.

"I believe that it is the right decision for our national security," Obama said. "The conduct represented in the recently published article does not meet the standard that should be set by a commanding general."

Obama said that as hard as it is to lose the general, the "war is bigger than any one man or woman." More importantly, he said, the war requires a unified effort from civilian and military leaders, warning that he won't tolerate division within his team.

"I believe that this mission demands unity of effort across our alliance and across my national security team," Obama said. "And I don't think that we can sustain that unity of effort and achieve our objectives in Afghanistan without making this change."

The president urged the Senate to swiftly confirm Petraeus, who would leave his Central Command position. Senate Armed Services Committee chairman Carl Levin, D-Michigan, later said a confirmation hearing would begin no later than Tuesday, and he expected it to take one day.

"We know Gen. Petraeus," Levin said. "I don't think there will be anybody who will say we need more time."

McChrystal issued a statement Wednesday saying that he strongly supports Obama's strategy in Afghanistan and is "deeply committed" to the coalition forces and the Afghan people.

"It was out of respect for this commitment -- and a desire to see the mission succeed -- that I tendered my resignation," McChrystal's statement said. "It has been my privilege and honor to lead our nation's finest."

A source close to McChrystal offered a description of the roughly 30-minute meeting between Obama and McChrystal that led to the general's resignation Wednesday morning. McChrystal briefly explained the magazine article at the center of the controversy, took responsibility and then offered his resignation, the source said. Obama accepted the resignation, the source said.

The president "had no intention of keeping him," and McChrystal knew that going in, the source said. McChrystal is not returning to Afghanistan, and his personal belongings will be shipped home, according to the source.

Immediate political reaction from both parties was positive, with lawmakers saying Obama had little choice in making a change and that Petraeus was the best choice for the job. Levin noted that Petraeus authored the counterinsurgency strategy now being followed in Afghanistan.

The spokesman for Afghan President Hamid Karzai expressed disappointment at the loss of McChrystal but called Petraeus the "obvious" replacement, while statements from allied governments and NATO also offered support and commitment to the Afghanistan mission.

In the magazine article, McChrsytal and his top officers are quoted making disrespectful comments about civilian officials including Biden, U.S. Ambassador to Afghanistan Karl Eikenberry, special representative to Afghanistan Richard Holbrooke and National Security Adviser Jim Jones.

News of the article set off a political firestorm Tuesday. Obama was "angry" after reading the general's remarks, said White House press secretary Robert Gibbs, who added that McChrystal had a "profound" mistake.

McChrystal apologized Tuesday, but was recalled to Washington and met with Gates and Mullen on Wednesday before going to the White House, Pentagon spokesman Geoff Morrell said. After he met with Obama, McChrystal was not invited to participate in a separate White House national security meeting on the war in Afghanistan, two sources told CNN.

The reported remarks by McChrystal and his staff were strongly criticized on Capitol Hill. Three key Senate leaders on defense and foreign policy issues -- Republican Sens. John McCain of Arizona and Lindsey Graham of South Carolina and independent Sen. Joe Lieberman of Connecticut -- said in a news conference Wednesday that Obama had no choice but to replace McChrystal.

"The statements of the general not only were outside the norm, they really did put into question military subordination of civilian control," Graham said, taking particular issue with unnamed officers in the article who he said showed disrespect and a cavalier attitude he termed "unacceptable."

"This is a low point in my view for the armed forces in a very long time, and I'm glad the president made this decision," Graham said. "There are some other officers that need to be looked at, and they need to be replaced."

At the same time, the senators and others said Obama should now make clear that a troop withdrawal from Afghanistan will only occur when conditions allow it, rather than on the July 2011 date set by the administration.

Petraeus "is an outstanding military leader, but even he can't win in Afghanistan if the president continues to insist on an arbitrary withdrawal date -- a fact our enemies are counting on and our allies fear," said Sen. Kit Bond of Missouri, the top Republican on the Senate Intelligence Committee.

Levin, D-Michigan, told reporters that Petraeus supports the July 2011 date for starting a troop withdrawal based on conditions on the ground.

"What will be conditions-based is not whether reductions begin in July 2011, but the pace of those reductions," Levin said Petraeus told him.

Levin acknowledged that Petraeus or Obama could change their minds on the issue, saying, "nothing is etched in stone."

Senate Foreign Relations Committee chairman John Kerry, D-Massachusetts, said in a written statement that Obama's "decision to return Gen. (David) Petraeus to the battlefield provides not just continuity in philosophy, but tested diplomatic skill that is at the very center of a military strategy which hinges on progress in governance to sustain military gains."

House Armed Services Committee chairman Ike Skelton, D-Missouri, said that Petraeus "is the best that we have."

"I have great confidence in his ability to bring about a successful outcome in Afghanistan. The commander-in-chief must have confidence in his commanders in the field," he said. "It is time to move on and return our focus to waging the war in Afghanistan."

A spokesman for the Afghanistan Defense Ministry said his government would have preferred to see McChrystal stay, but was happy Petraeus had been tapped as the replacement.

"We're not happy to see Gen. McChrystal go, but of all the choices that could have been made, we are happy to hear it is Petraeus who will continue the mission," Gen. Mohammad Zahir Azimi said.

Obama tapped McChrystal to head the U.S. military effort in Afghanistan in the spring of 2009 shortly after dismissing Gen. David McKiernan. McChrystal was strongly recommended as the best choice to carry out the counterinsurgency strategy created by Petraeus in Iraq, but administration officials later expressed displeasure with what they thought was McChrystal's leak of his request for more troops for Afghanistan before Obama completed his review of the issue.

The president eventually ordered 30,000 additional troops to Afghanistan, most of the number sought by McChrystal.

CNN's John King, Suzanne Malveaux, Barbara Starr, Dana Bash, Alan Silverleib, Ted Barrett and Tom Cohen contributed to this report.