The shocking resignation of CIA kingpin DAVID PETRAEUS seems more like a bad pulp novel than the stuff of sordid reality.

The esteemed four star general sent his former mistress, PAULA BROADWELL, (is this an Ian Fleming James Bond yarn? Broad Well?) a barrage of sexy emails including explicit ones about "sex under the ndesk," with literally thousands of messages sent after she ended the affair last year.

Petraeus and Broadwell, who are both married, met six years ago when she was a researcher at Harvard pursuing her PhD, and he came to speak at the university.

A West Point grad and military vet herself, Broadwell later took on the project of researching Petraeus. and when Petraeus went to Afghanistan as head of the coalition's efforts there, Broadwell was embedded with him between July 2010 and 2011.

The mom of two reportedly broke off the affair after Petraeus became CIA chief on September 6, 2011.  Her book ,All In: The Education of General David Petraeus, came out in February, and Broadwell promoted on numerous TV shows.

The affair was discovered almost accidentally almost six months ago, when the FBI began investigating whether a computer used by Petraeus had been compromised, reports The New York Times.

"My impression is that the F.B.I. stumbled across this," a Congressional source told The Times.

One military source who has worked with Petraeus said that Broadwell's attempts to "get her claws into" the CIA chief were an open secret.

"I've known her for a few years, probably five or six,' one source told

"When she started work on the bio she called me for background on one of the general's previous deployments. I probably gave her four hours or so, and we stayed in touch after that by email and an occasional phone call.

"Over that time, she went from someone very likeable to a shameless self-promoting prom queen.

"A very disturbing shift in how she carried herself. If she knew P4 was going to make an appearance at an event, she'd crash it without an invitation (she actually did this at the wedding of some close friends of mine) and photo bomb[ed] everyone there."

Although there has been no suggestion that the affair in any way compromised security, what it said about the General's judgment made his staying in office at the CIA impossible.

On Friday he resigned.

“After being married for over 37 years, I showed extremely poor judgment by engaging in an extramarital affair,” Petraeus said in his statement. “Such behavior is unacceptable, both as a husband and as the leader of an organization such as ours. This afternoon, the president graciously accepted my resignation.”