On one level, the latest scandal to rock US politics is quite straightforward – if somewhat tacky.

It's the story of the high-profile four-star US general who had an affair with his pretty and vivacious biographer, who then started harassing her equally attractive love rival, who herself was engaged in an over-heated epistolary relationship with another four-star general. All four participants are themselves married. Could a plot of this kind only have been fashioned in Hollywood?

Not so: this is a real-life story which has been gripping readers across the US for the past week, since the unexpected resignation of former General David Petraeus as head of the CIA. An all-American military hero who made his name serving in Iraq and Afghanistan, where he developed revolutionary counter-insurgency tactics, Petraeus stood down as the country's leading spook after admitting having had a sexual relationship with his biographer, Paula Broadwell, a powerful if relatively unknown Washington insider who also happens to be an army reserve officer.

Bad though these revelations were, worse followed when an FBI investigation discovered that Broadwell had been sending abusive messages to Jill Kelley, a Florida-based socialite and a family friend of Petraeus and his wife, Holly. To add to the problem, Kelley was not without baggage herself – she had received a reported 30,000 "flirtatious" emails from another high-ranking US soldier, General John Allen, commander of the US forces in Afghanistan. He now finds himself temporarily debarred from being promoted to take over command of Nato's ground forces in Europe.

Leaving aside the question of how two such busy and presumably committed generals could find the time or the inclination for their dalliances – it gives a new meaning to the business of multi-tasking – there are huge security implications in both cases. While writing her biography, Broadwell was given exceptional access to Petraeus and the upper reaches of US military command in Afghanistan. Although that clearance has now been withdrawn, she remained close to him after he was appointed director of the CIA in 2011 and so far the FBI has been unable to ascertain if any pillow talk encroached on national security issues.

As for Lebanon-born Kelley, there are question marks over her role as a "volunteer social liaison officer" with the local Central Command military headquarters at Tampa – a job that gave her unprecedented access to high-ranking military officers in return for acting as an unpaid party-giver and all-round military groupie. (An unlooked-for aside to this tawdry episode is that an FBI agent had to be taken off the case after he was discovered sending bare-chested snapshots of himself to Kelley.)

None of this kind of behaviour is particularly new in US military history. During the second world war, the allied supreme commander US General Dwight D Eisenhower had an exceptionally close and intimate relationship with his Irish-born driver, Kay Summersby, and rumours about a full-blown love affair between the two continued to flourish long after their deaths. At the same time, one of Eisenhower's rivals, General George S Patton, was a renowned philanderer who never went anywhere without a supply of condoms, and took pride in being considered a red-blooded womaniser. Both generals remained married, and in a pre-internet age their extra-marital relationships went unreported.

This has not been the case with Petraeus and Allen, both of whom have been held up to widespread ridicule for their relationships with younger women. Of the two, Petraeus is the better known and as a result he has been the most badly burned.

At the end of a torrid week, he attempted to regain lost ground by admitting that he had been a fool and had badly let down his wife, Holly – they have been married for 37 years – as well as their two children. Friends say that his relationship with Broadwell was an error of judgment for which he can only attempt to atone in due course and that when acknowledging his culpability he at least sounded repentant.

However, while this might be the stock response of a man found with his trousers down, his affair with Broadwell – as well as Allen's relationship with Kelley – leaves a dark cloud over the whole concept of being an honourable officer in the country's armed forces.

In the US army, adulterous affairs are illegal and in the interests of maintaining morale and group cohesion, sexual relationships between serving personnel are disallowed in operational theatres such as Afghanistan. But that has not stopped sex scandals rocking the US armed forces. Last year, nearly 3200 rapes and sexual assaults were officially reported by service personnel – and the Pentagon has admitted that figure represents just 15% of all such incidents.

One of the worst involves another senior officer, Brigadier-General Jeffrey A Sinclair, who is facing court martial proceedings after being accused of 26 violations of military law including forcible sodomy, wrongful sexual conduct, possessing pornography and conduct unbecoming of an officer.

Responding to this rise in cases involving sexual bad behaviour, US defence secretary Leon Panetta has instructed his chiefs of staff to produce a new code of ethical conduct which will apply to all service personnel, especially senior officers. In the past such regulations were considered unnecessary, on the grounds that all officers in the US armed forces should understand what constitutes "gentlemanly" or "ladylike" behaviour. But the recent flurry of scandals has convinced senior officers that self-regulation is not working.

The only group which has taken some pleasure from the US forces' discomfort over these lurid allegations has been the Taliban in Afghanistan. Responding to the revelations, several local Taliban warlords have suggested that Petraeus should either be handed over to his mistress's family for ritual execution or simply stoned to death as an adulterer under the terms of sharia law.

the love pentagon: how the petraeus affair unfolded

Early summer 2012

AN investigation is triggered after Jill Kelley, pictured right, complains to an FBI acquaintance that she has been receiving anonymous harassing emails, which accused her of inappropriate behaviour with one of the most powerful men in the US – CIA director-general David Petraeus. Kelley, 37, is a high-profile Florida socialite and family friend of Petraeus and his wife, Holly.

Late summer 2012

The FBI investigation reveals the emails have come from Paula Broadwell, above, a married mother-of-two and former military intelligence officer. She first met Petraeus in 2008 and wrote a biography of the general while he was commander of international forces in Afghanistan.

October 22-29

The FBI interviews Petraeus, who admits to an affair with Broadwell, which began around November 2011. However, he denies having given Broadwell any national security information. The FBI has already interviewed Broadwell and found classified information on her computer. During this week, Broadwell also gives a speech in which she refers to information on an attack on the US consulate in Libya – which has never been previously publicly released.

November 7

Petraeus's 60th birthday. Intelligence officials inform the White House about his affair.

November 8

President Barack Obama is informed of the affair when he returns to Washington fresh from his re-election victory. He meets with Petraeus, who asks for permission to resign from the top post he has held since September 2011.

November 9

Petraeus' resignation is accepted by Obama and he publicly admits to the affair. Broadwell's husband Scott contacts a friend to cancel a party arranged to celebrate her 40th birthday.

November 13

FBI agents search Broadwell's home in Charlotte, North Carolina and are seen removing computers, printers and cardboard boxes from the property. Reports emerge that the FBI agent who first acted on Kelley's complaint, Frederick Humphries, above, is under investigation himself by the agency over accusations he became "obsessed" with the case, although he was not assigned to it. A "shirtless" picture he sent to Kelley before the investigation began also emerges, although he later insists this was a joke sent to dozens of people. He is dubbed "Agent Shirtless". In a separate twist, the Pentagon says an internal investigation is being undertaken into "potential inappropriate" communications between General John Allen, right, the top US Commander in Afghanistan and Kelley. Reports claim that around 20,000 to 30,000 "flirtatious" emails were exchanged between them. Allen insists he has done nothing wrong and pledges to "fully co-operate".

November 16

Petraeus gives evidence to the House Intelligence Committee and its Senate counterpart regarding the attack on the US consulate in Libya in September. He is briefly questioned over his personal life, but lawmakers accept his word that his affair had not compromised national security. Meanwhile, fresh questions are raised over Kelley's association with the top levels of government after it emerges she had visited the White House three times in three months with her twin sister.