The resignation of CIA Director David Petraeus has brought a sudden and unexpected end to the public career of a four-star general who led U.S. troops in Afghanistan and Iraq and was thought to be a potential candidate for president.

Petraeus admitted to an extramarital affair in tendering his resignation, which President Barack Obama accepted Friday.

Petraeus carried on the affair with his biographer Paula Broadwell, a reserve Army officer, according to several U.S. officials with knowledge of the situation. They spoke anonymously because they were not authorized to discuss publicly the investigation that led to the resignation.