The FBI probe into the sex scandal that prompted CIA Director David Petraeus to resign has expanded to ensnare Gen. John R. Allen, the commander of U.S. and NATO troops in Afghanistan, the Pentagon announced early Tuesday.

According to a senior U.S. defense official, the FBI has uncovered between 20,000 and 30,000 pages of documents — most of them e-mails — that contain “potentially inappropriate” communication between Allen and Jill Kelley, the 37-year-old Tampa woman whose report of harassment by a person who turned out to be Petraeus’s mistress ultimately led to Petraeus’s downfall.

Allen, a Marine, succeeded Petraeus as the top allied commander in Afghanistan in July 2011. He also served as Petraeus’s deputy when both generals led the military’s Tampa-based Central Command from 2008 until 2010.

The FBI first notified the Pentagon of its investigation into Allen’s communications with Kelley on Sunday evening, according to the senior defense official, who spoke on condition of anonymity to discuss details of the pending case.

In response, Pentagon chief Leon E. Panetta referred the investigation on Monday to the Defense Department’s Inspector General for further review, according to a statement released by Panetta early Tuesday as he was traveling to Australia.

The Pentagon did not address the nature of Kelley’s alleged relationship with Allen. But another senior U.S. official, who is close to Allen, strongly denied that the general and Kelley had an affair or engaged in inappropriate communication. Allen and Kelley, who threw parties and other social events involving senior leaders at the Central Command, did exchange “a few hundred e-mails over a couple of years,” beginning when Allen was the deputy commander at the Central Command, this senior official said. But “most of them were about routine stuff.”

“He’s never been alone with her,” the senior official said. “Did he have an affair? No.”

The senior official also emphasized that the volume of communications between the two “was nowhere near” 20,000 to 30,000 personal messages. The official said the high page count reported by the FBI may have been the result of printing numerous individual messages that contained lengthy threads of earlier exchanges.

The senior official said Allen received at least one e-mail about Kelley from an unidentified account that eventually was traced to Paula Broadwell, a former Army officer who was Petraeus’s biographer and, it turns out, his mistress.

Allen discussed that e-mail with Kelley, who was receiving a slew of harassing messages at the time, the senior official who is close to Allen said. Kelley, who did not know the messages were being sent by Broadwell, notified the FBI.

Some of the e-mails may have prompted suspicions among FBI investigators because Allen sometimes used words such as “sweetheart” to refer to her, the senior official said. But the official added that Allen, who was raised in Virginia, employed that language as a term of platonic friendship, not romantic interest.

The senior official described Kathy Allen, the general’s wife, and Kelley as “good friends.”

“He’s embarrassed by this,” the senior official said. “But there’s no there there.”

Still, the scrutiny of Allen’s personal behavior extends a remarkable string of failures and misconduct allegations that have dogged the last four commanders of the Afghan war. Petraeus took the job in 2010 after President Obama fired Army Gen. Stanley McChrystal for cooperating with a Rolling Stone profile that quoted McChrystal’s aides as mocking the president, Vice President Biden and other civilian leaders.

McChrystal had lasted only a year after taking over from Gen. David McKiernan, who was sacked when then-Defense Secretary Robert M. Gates lost confidence in his ability to fight the war.

The unfolding scandal has shaken President Obama’s national-security staff and upended his carefully chosen plans for filling senior military and intelligence leadership jobs in his second term.

It also further calls into question the personal behavior of two of the U.S. military’s highest-ranking and most respected figures, who apparently ignored concerns about the highly sensitive nature of their positions as they embraced personal relationships with younger women who were not their wives.

Petraeus’s fall from grace shocked the CIA but especially stunned his former colleagues in the Army, where he was considered one of the most brilliant and influential commanders of his generation. Allen was likewise seen as an intellectual and upstanding role model who first made his mark as a general in Iraq during the George W. Bush administration and later earned Obama’s confidence.

In Washington, House Minority Leader Nancy Pelosi (D-Calif.) told reporters Tuesday that the Petraeus scandal apparently did not involve national security, which would have triggered a requirement for congressional notification. The CIA’s acting director is talking to congressional leaders “about what has transpired and how we will go forward,” she said.

“But I think that it’s really important to note that this was a personal indiscretion, as far as we know,” Pelosi said. “Why somebody would be personally indiscreet is their own problem. Why they would do it in e-mails is beyond my imagination. But in any event, the honorable thing was done. The general has resigned.”

There are “questions about timing, just as a tradition to notify Congress before we see it on TV,” she said. “If it involves national security, though, that’s a different story. So far, we do not believe that it involves national security.”

In his statement, Panetta said Allen would remain as commander of U.S. and NATO forces in Afghanistan for now, “while the matter is under investigation and before the facts are determined.” The senior defense official said Allen “disputes that he has engaged in any wrongdoing,” but would not elaborate.

But his time as commander in Afghanistan may be short. Panetta has also asked the Senate to expedite the confirmation of his likely successor, Marine Gen. Joseph F. Dunford.

Obama had nominated Dunford last month to replace Allen. Coincidentally, the Senate Armed Services Committee had already scheduled his confirmation hearing for Thursday. Panetta said he has asked the Senate to expedite its review of Dunford’s nomination.

Allen had been simultaneously nominated by the White House to take over as chief of the military’s European Command and NATO’s Supreme Allied Commander in Europe. That nomination is now on hold, Panetta said, pending the outcome of the probe of his communications with Kelley.

“At the request of the secretary of defense, the president has put on hold his nomination of General Allen,” Tommy Vietor, a spokesman for the National Security Council, said in a statement. “The president remains focused on fully supporting our extraordinary troops and coalition partners in Afghanistan, who General Allen continues to lead as he has so ably done for over a year.”

The Obama administration is in the final stages of determining its timeline for withdrawing the remaining 68,000 U.S. troops in Afghanistan and is also debating how many trainers, Special Operations Forces and other military assets it will keep in the country after 2014, when the White House has pledged to end combat operations and hand over security responsibilities to the Afghan national army and police.

On Monday, Panetta told reporters that Allen had recently presented options to the Pentagon and White House for what the U.S. military presence could look like in Afghanistan in 2015 and beyond. Panetta said the Obama administration is likely to decide that question in about two weeks. After that, the administration will map out the timeline for troop withdrawals through the end of 2014, again based largely on recommendations from Allen, defense officials said.

The latest twist in the scandal became public early Tuesday, as Panetta was flying here for two days of scheduled meetings with Australian officials. His staff abruptly distributed a prepared statement to reporters traveling with him on his military aircraft.

Panetta had met with the journalists a few hours beforehand for a short news conference about his trip to Asia and made brief comments about Petraeus’s resignation — “I think he took the right step” — but did not reveal that he had been told a day earlier that the FBI was also investigating Allen.

After his arrival in Perth, Panetta ignored a shouted question from a reporter about the Allen investigation as he entered a hotel for a meeting with Australian Prime Minister Julia Gillard.

Pentagon officials said they notified the leaders of the Senate and House armed services committees about the probe of Allen’s behavior late Monday night, a few hours before Panetta issued his statement. Panetta did not shed any light into the nature of the probe; he said Allen “is entitled to due process in this matter.”

Allen was in Washington when the Pentagon learned about the FBI investigation, the senior defense official said. He was informed of the FBI and Defense Department Inspector General probes by Gen. Martin Dempsey, the chairman of the Joint Chiefs of Staff.

Dempsey, who is in Perth along with Panetta and Secretary of State Hillary Rodham Clinton, phoned Allen from Australia on Monday evening, Washington time, according to a senior U.S. military official.

Although the FBI has shared the e-mails and other documents with the Pentagon, the senior defense official would not describe them in detail or say whether they were romantic in nature.

“We are concerned about inappropriate communications,” the official said. “We are not going to speculate as to what is contained in these documents.”

Allen, 58, attended Flint Hill School in Oakton, Va., before graduating from the Naval Academy in Annapolis. He is married and has two grown daughters. His wife, Kathy, appeared with him in public in March at a Senate hearing on the war in Afghanistan.

Kelley’s name surfaced in the Petraeus scandal over the weekend after U.S. officials disclosed that she contacted the FBI last summer to complain that she had received anonymous and threatening e-mails about her relationship with the CIA director.

An FBI field investigation determined that Broadwell was the sender of the e-mails. Broadwell and Petraeus later admitted to the FBI that they had engaged in an affair.

Associates of Petraeus have said he was not romantically involved with Kelley, although they acknowledged she was a close friend of Petraeus and his wife.

The senior defense official said the voluminous collection of e-mails sent between Allen and Kelley occurred between 2010 and this year. The official did not give details and declined to say whether Allen sent or received any of the messages from his military or government e-mail accounts, or whether classified material was compromised.

Carmen Romero, a NATO spokeswoman, said leaders of the military alliance were notified by the U.S. government about the investigation into Allen but that they declined to comment on the case or on whether the general should remain in command of coalition troops in Afghanistan.

Chandrasekaran reported from Washington. William Branigin contributed to this report.