John Allen testifies during his confirmation hearing before the Senate Armed Services Committee on Capitol Hill on June 28, 2011, in Washington. (Chip Somodevilla/GETTY IMAGES)

John R. Allen, the four-star Marine general who commands U.S. and NATO forces in Afghanistan, intended to spend a low-key week in Washington working on plans to end the war and start a prestigious new assignment. He was scheduled to discuss proposals for troop reductions with Pentagon officials, and he was to appear before the Senate for what was expected to be a slam-dunk confirmation hearing to become the next top allied commander in Europe.

All of that is now on hold. The disclosure early Tuesday that Allen exchanged numerous e-mails with Jill Kelley, a 37-year-old Tampa socialite involved in the David H. Petraeus sex scandal, has thrust the general into an unexpected battle in the capital: a fight for his professional life.

The few details that have been released by the Defense Department suggest that Allen has much explaining to do. The printouts of the exchanges and associated documents stretch for 20,000 to 30,000 pages. Some of the messages were “flirtatious,” according to a senior Pentagon official. Another called them “potentially inappropriate.”

On Wednesday, Defense Secretary Leon E. Panetta continued to deflect questions about the nature of the e-mails between Allen and Kelley and would not say why the Pentagon considered them “potentially inappropriate.”

“No one should leap to any conclusions here,” he told reporters in Perth, Australia, where he was visiting as part of a week-long trip to Asia.

President Obama had nominated Allen last month to take a new job as NATO’s supreme allied commander in Europe and as head of the U.S. military’s European Command. But Panetta said that nomination would not proceed until the Defense Department’s Inspector General can complete its investigation into Allen’s relationship and communications with Kelley — something that possibly could take several months.

“His nomination has been put on hold until we can determine what the facts are, and we will,” Panetta said.

Allen remains in charge of all NATO and U.S. forces in Afghanistan, although a Senate panel will meet Thursday to question his appointed successor, Marine Gen. Joseph Dunford. Obama nominated Dunford last month, before the scandal erupted.

Secretary of State Hillary Rodham Clinton, also in Perth to meet with Australian leaders, said U.S. officials have explained the Allen probe to NATO members and other allies with troops in Afghanistan.

“There’s been a lot of conversation, as you might expect,” she said, “but no concerns.”

Officials close to Allen insisted that he did not have a sexual relationship with Kelley. Allen’s partisans proffer a more innocuous explanation for the volume of messages, which, they contend, was in the hundreds, not the thousands described in news reports. The officials say that Kelley was a close friend to Allen and his wife, Kathy. Although Allen, who was raised in Virginia, sometimes used words such as “sweetheart” in addressing Kelley, the officials said, he intended it as a term of platonic friendship, not romantic interest.

The problem, his allies said, is that Kelley was a prolific e-mailer. And so is Allen.

Starting four years ago, when he became the deputy chief of the Central Command, his inbox and outbox filled with messages to and from Kelley, a married mother of three who has cultivated close ties with several senior military commanders, including Petraeus, who have spent time at MacDill Air Force Base in Tampa, home to the Central Command.

According to a senior official close to Allen, many of the missives related to social events or to items Kelley had seen in the news. Sometimes she wrote to compliment him on a television interview. Sometimes she copied the general on a message intended for his wife.

“He returns almost every ­e-mail,” the official said. “To him, it’s a sign of politeness.”

The frequency of Allen’s communication with Kelley prompted questions about whether his focus on the war was compromised. But Allen, the official said, generally reads and responds to personal e-mail between midnight and 2 a.m., when most of his subordinates have gone to bed.

The 6-foot-tall, silver-haired Allen comes across more as professor and Southern gentleman than a hard-bitten Marine general. He is courteous and prone to measured locution. He reads military histories before turning out the light — he sleeps only about four hours a night — and he sets aside several hours each week “to think about big ideas.”

Allen, 58, blazed an unconventional path to the commander’s office in Kabul. A native of Warrenton, Va., he decided to apply to the U.S. Naval Academy after hearing his father, a Navy radio man who served in World War II, share tales of naval heroism.

Although Allen would go on to lead a Marine infantry company and a battalion, he never had sole command of a division-size unit — a prerequisite to becoming a four-star wartime commander. Instead, his career has been filled with unusual accomplishments: He won a coveted leadership award given to only one Marine captain each year, and he became the first Marine to serve as the commandant of midshipmen at the Naval Academy.

He spent two years in Iraq’s Anbar province, where he led an effort to reach out to Sunni tribal leaders and persuade them to stand against al-Qaeda militants — a shift that helped turn the course of the war in western Iraq.

He eventually became the deputy commander of the Central Command, where his portfolio focused largely on Iran. The job afforded him the opportunity to brief President Obama, who grew impressed by the general’s analyses. When Obama appointed Petraeus to head the CIA, Allen got tapped to go to Kabul.

Allen could not be more different than Petraeus, his fellow four-star protagonist in the unfolding scandal.

Unlike his predecessor in Kabul, Allen rarely grants extended interviews to journalists, and when he is at home, he prefers to dine with his wife instead of attending cocktail receptions. “He’s deeply embarrassed by this,” the senior official said.

In Afghanistan, he has shifted away from Petraeus’s ­resource-intensive counterinsurgency strategy. He has narrowed targets to the development of local government, the pursuit of corruption and economic development. His focus is on the essential prerequisite for the United States to head for the exit, as defined by the White House: Afghan security forces that are strong enough to keep the Taliban, which continues to enjoy sanctuary in neighboring Pakistan, from toppling the Kabul government.

Although much of the Afghan army remains fragile, with poor leadership and persistent supply shortages, he is betting that shifting responsibility sooner will increase the odds that Afghans will be able to hold their ground once the U.S. presence shrinks.

By moving to unwind the war, Allen has earned a degree of praise from Obama that never was accorded to his predecessors. When Obama and Allen walked out of a lunch in the White House earlier this year, the president put his arm around the general, according to administration and military officials. “John Allen is my man,” Obama said to staffers waiting in an anteroom.

On Tuesday, the White House let it be known that Allen still had the president’s support, despite what might be a lengthy Defense Department inspector general’s investigation and a delay until February of his confirmation hearing.

“The president thinks very highly of General Allen,” said White House spokesman Jay Carney. “He has faith in General Allen.”