IN the latest twist of the David Petraeus sex scandal, court records show the former CIA director and General John Allen intervened last September in a messy custody dispute on behalf of Jill Kelley's twin sister, whom a judge described as dishonest and lacking integrity.

Kelley is the woman who received harassing emails from Petraeus' biographer and lover, according to US officials.

She also is thought to have exchanged flirtatious communications with Allen, the top US commander in Afghanistan. Pentagon investigators are now examining Allen's relationship with Kelley.

The new court files are significant because they provide of a fuller picture of the twins' connections to Petraeus and Allen, two powerful figures ensnared in the scandal.

It also raises questions why two decorated generals would vouch for Kelley's twin sister, Natalie Khawam, who had piles of legal troubles in recent years.

Petraeus resigned on Friday as CIA director after disclosures that author Paula Broadwell sent the emails to Kelley, who in turn went to the FBI, setting off a series of stunning revelations that have engulfed Washington just days after President Barack Obama was re-elected.

Both Allen and Petraeus wrote letters in September supporting Khawam in her ongoing custody fight for her son, DC Superior Court records show.

Allen met Khawam, 37, when he was deputy commander of US Central Command in Tampa, where they attended social functions. Petraeus said he met Khawam three years ago through Kelley.

Both men said she was a loving mother and asked the judge in the case to drop onerous visitation restrictions.

But Superior Court Judge Neal Kravitz a year earlier criticised Khawam for her behaviour and said her "misrepresentations about virtually everything" would continue.

"Ms Khawam appears to lack any appreciation or respect for the importance of honesty and integrity in her interactions with her family, employers and others with whom she comes in contact," he wrote in November 2011.

Not only did the judge in the case award her ex-husband custody last year of their three-year-old son, John, but he also told Khawam to pay his legal bills amounting to $US350,000 ($A337,040).

Khawam filed for Chapter 7 bankruptcy in April after racking up more than $3 million in debt, according to federal court records.

A NOTE ABOUT RELEVANT ADVERTISING: We collect information about the content (including ads) you use across this site and use it to make both advertising and content more relevant to you on our network and other sites.