Emails to a socialite link Gen. John Allen to the mess, causing his nomination to a key post to be put on hold.

WASHINGTON— The messy scandal that forced CIA Director David H. Petraeus to resign and sparked a Pentagon investigation of the U.S. war commander in Afghanistan has thrown the Obama administration's national security team into turmoil.

The ripples continued to widen Tuesday as Defense Secretary Leon E. Panetta ordered an investigation of Gen. John Allen, commander of U.S. and international forces in Afghanistan, after the FBI informed the Pentagon that it had uncovered what may be inappropriate emails between Allen and Jill Kelley, a 37-year-old Florida socialite and friend of Petraeus, Allen and their wives.

Panetta said he had asked the Senate to place Allen's nomination as supreme allied commander in Europe on hold until the investigation was complete, delaying his shift to a key post overseeing all NATO military operations.

The upheaval comes at an awkward time for the White House, the Pentagon and the intelligence community. The administration faces hearings in Congress this week over the Sept. 11 militant attack in Benghazi, Libya, that killed the U.S. ambassador and three other Americans, and is debating whether to speed up withdrawal of U.S. combat troops from Afghanistan.

In addition, Panetta and Secretary of State Hillary Rodham Clinton, two of President Obama's most experienced and respected political veterans, are likely to step down early next year. Clinton's intention to leave has been public for more than a year.

White House spokesman Jay Carney said Obama "thinks very highly" of Allen. But Carney said he "wouldn't call it welcome" that a scandal erupted a week after Obama's reelection, when the president had been hoping to focus on a deficit-reduction deal with Congress.

Kelley was home with her children Tuesday evening and refused to see visitors at the family's red-brick mansion on elegant Bayshore Boulevard in Tampa, Fla. An SUV was parked in the driveway and fresh flowers sat in a front dining room. TV news crews loitered near the manicured lawn as joggers filed past.

Allen's contacts with Kelley came to light after FBI agents looked into her complaint that she had received anonymous emails warning her to stay away from Petraeus. The sender of the emails used aliases, and the messages included nonpublic information about the travels of Petraeus and other U.S. officials, a senior law enforcement official said. The FBI eventually traced the emails to Paula Broadwell, 40, an officer in the Army Reserve who wrote a fawning 2012 biography of Petraeus.

A review of Broadwell's emails showed she had engaged in an extramarital affair with Petraeus. The case took a new turn in September when she gave the FBI her computer, which turned out to contain several classified documents. Broadwell holds a top-secret clearance, but the discovery raised fresh concerns of a potential security breach. Petraeus denied being the source of the documents, and Broadwell said she did not get them from him.

Broadwell consented to an FBI search of her home in Charlotte, N.C., on Monday night, the official said, adding that no charges would be filed. "This is just running down the final alley, just trying to tie it up."

The initial FBI investigation also uncovered emails between Kelley and Allen, beginning when he was deputy head of U.S. Central Command at MacDill Air Force Base near Tampa from 2008 to 2011. Kelley and her husband, Scott, a prominent Tampa doctor, cultivated close social ties with senior officers, sponsoring events for wounded soldiers and galas for commanders and visiting delegations over the years, current and former officials and officers say.

The Kelleys were especially close to Petraeus and his wife, Holly, often attending parties and holiday events at each other's homes when Petraeus headed Central Command from 2008 to 2010. They remained in contact after Petraeus took command of the Afghan war and, when he retired from the military, moved to Washington to take over the CIA in September 2011.

In September of this year, Jill Kelley's twin sister, Natalie Khawam, needed character references to appeal to a judge in Washington over losing custody of her 4-year-old son. Allen and Petraeus composed letters on her behalf.

"My wife, Kathy, and I came to know Natalie when I served at headquarters of U.S. Central Command as the Deputy Commander," Allen wrote on his official letterhead. A copy was obtained by the New York Post. "On multiple occasions we had the privilege of observing her … at command social functions.... She is a dedicated mother, whose only focus is to provide the necessary support, love and care for her son."

A senior U.S. official who is familiar with the investigation said Allen and Kelley "have never been alone together, ever." The official said they had exchanged several hundred mostly short emails over several years, denying reports that the emails filled 20,000 to 30,000 pages.