The director of the Central Intelligence Agency (CIA) David Petraeus has stepped down from his post citing an extra-marital affair.
Calling the affair "unacceptable", Petraeus said it was an "extremely poor judgment" on his part.
The 60-year-old said in his letter to the agency that he had asked President Barack Obama "to be allowed, for personal reasons, to resign from my position."
"After being married for 37 years, I showed extremely poor judgment by engaging in an extramarital affair. Such behaviour is unacceptable, both as a husband and as the leader of an organisation such as ours," said Petraeus.
Obama accepted Petraeus's resignation and expressed his appreciation for his work at the agency. Petraeus took over as director in 2011 after resigning from the US army.
"By any measure, through his lifetime of service David Petraeus has made our country safer and stronger. Going forward, my thoughts and prayers are with Dave and Holly Petraeus, who has done so much to help military families through her own work," Obama said in a statement.
The other party in the affair appears to be the 40-year-old author Paula Broadwell, reported Reuters. She has published a biography of Petraeus but has so far proved impossible to contact.
Michael Morell has stepped in as acting director of the CIA. "I know I speak for the men and women of CIA in thanking Director Petraeus for his dedicated service to our Agency and our country. I am grateful to have had the opportunity to work with him as he led this amazing organisation, and I admire the drive and focus he brought to the job. Indeed, the energy he devoted to managing our mission and workforce was second to none," said Morell.
The affair was brought to light by the FBI, suggest reports.
It is not known how long Petraeus was in a relationship with the woman and why he suddenly decided to resign three days after the US presidential election.
The affair brings the curtain down on Petraeus's distinguished career. He played a prominent role in the Iraq war and led the US troops in Afghanistan.
Coincidentally, the incoming CEO of US defence contractor Lockheed Martin has also resigned over an extra-marital relationship.
Christopher Kubasik, who was to take over as head of the company next year, resigned after an internal investigation revealed the "close personal relationship", Lockheed Martin said in a statement.