Updated

Defense Secretary Robert Gates plans to retire on June 30, a senior Pentagon official told Fox News -- a revelation that comes ahead of President Obama's expected announcement Thursday that CIA Director Leon Pannetta is replacing him as part of a broader shakeup in the president's national security team.

The White House hopes to have Panetta confirmed before Gates steps down, the official said.

Obama also plans to announce Thursday that Gen. David Petraeus, the U.S. commander in Afghanistan, will replace Panetta as CIA director, Lt. Gen. John Allen will replace Petraeus and diplomat Ryan Crocker will be the next U.S. ambassador to Afghanistan.

A senior defense official also told Fox News the president will "almost certainly" tap Gen. James Cartwright to be chairman of the Joint Chiefs of Staff. Cartwright is currently vice chairman.

The changes would probably take effect this summer.

The moves come as the United States faces a changing landscape in the Middle East and surrounding region. U.S. forces continue to work alongside NATO allies to keep Libyan leader Muammar al-Qaddafi at bay.

As the Obama administration determines how to handle the unrest in other countries, including Syria, the defense team, meanwhhile, is trying to complete the drawdown in Iraq and make more measurable progress in Afghanistan -- a task made more difficult by souring relations on the other side of the border with Pakistan.

The reaction inside the Beltway to the changes has been positive.

"The president has made a good decision in promoting both Gen. Petraeus and Mr. Panetta to key positions on his national security," said Sen. Jay Rockefeller, D-W. Va., said in a written statement. "Like outgoing Secretary of Defense Robert Gates, these leaders bring the right set of experience, perspectives and management skills to tackle the security and funding challenges that we face."

Former Sen. John Warner, R-Va., who was once chairman of the Senate Armed Services Committee, said Gates left "an exceptionally large pair of 'boots' to fill."

"But Director Panetta is eminently qualified from his extraordinary breadth and diversity of public service, and I am confident the Senate will receive him respectfully and confirm him," Warner Said.

Sen. Lindsey Graham, R-S.C., applauded the picks.

"The sum total of these picks is that the president has chosen experienced people with unique capabilities to serve our nation at a dangerous time," Graham said. "I could not be more pleased with these selections."