(MCT) — WASHINGTON — The top general in Afghanistan has been cleared in an email scandal that had threatened his career just as he was putting the finishing touches on plans for the American military drawdown in the 11-year-old war.

The Pentagon inspector general removed the cloud that had been hanging over Marine Gen. John Allen since last fall, according to Pentagon spokesman George Little, when he got caught up in the scandal that short-circuited the superstar career of retired general and former CIA Director David Petraeus.

Little said that Defense Secretary Leon Panetta, who requested the inquiry into Allen, “was pleased to learn that allegations of professional misconduct were not substantiated by the investigation. The secretary has complete confidence in the continued leadership of Gen. Allen, who is serving with distinction in Afghanistan.”

There was no announcement on whether the exoneration would put Allen’s expected next post as the U.S. supreme commander for Europe back on track.

His nomination had been sidetracked by allegations that he exchanged improper emails with a Tampa, Fla., socialite, Jill Kelley, who was well-known for organizing social events at MacDill Air Force Base, home to the U.S. Central Command. Allen served as second-in-command at Centcom before becoming head of all allied forces in Afghanistan more than a year ago, following Petraeus in that post.

The general’s troubles grew out of revelations of an extramarital affair between Petraeus and his biographer, Paula Broadwell, which led to Petraeus’ resignation from the CIA. Both are married.

Broadwell allegedly contacted Allen to warn him about Kelley. But Allen alerted Kelley of the warning, and Kelley asked a friend in the FBI to look into the matter.

The emails between Allen and Kelley, both of whom are married, were described by Defense Department officials at the time as “beyond flirtatious, and can probably be described safely as suggestive.” They were initially described as numbering about 30,000 pages. But the actual number of emails was in the hundreds and sent over a period of years, according to officials.

The inspector general determined they did not add up to conduct unbecoming to an officer.

As the email story unfolded, President Barack Obama praised Allen’s record of service and noted that he had seen nothing indicating that the emails compromised national security.