Having an extramarital affair is a problem when you are the director of the U.S. CIA, and it’s really a problem when you may have compromised the codes that allow only a chosen few people access to nuclear weapons.

That’s exactly the position David Petraeus was in, according to the Week, and it almost certainly contributed to his quick resignation.

Because Petraeus was so high up in the chain of command, he would have been on the short list of people with access to the briefcase that enables a nuclear attack. The black bag, nicknamed the football, must always be close to the U.S. president, but in the event of an assassination or other confusion, there is a line of succession in its handling.

Petraeus' status warranted his inclusion in the Nuclear Weapon Personal Reliability Program, which, as noted on the Federation of American Scientists' site, closely watches the personal behavior of government officials who have access to the nuclear codes.

“Adultery is not a minor sin under the PRP rules,” the Week’s Mark Ambinder wrote.

The U.S. Senate confirmed Petraeus as the CIA director as a civilian after he left the military, meaning he most likely would have been given emergency action training by the White House Military Office. Since the CIA director is outside the constitutional line of presidential succession, the likelihood that Petraeus could have activated a nuclear launch is unknown. Also classified is the documentation outlining the method to his carrying out that task.

The Week also reported the public knowledge of Petraeus’ affair would have made him less credible in the international community.

Petraeus' lack of discretion wouldn’t have been the first time the codes were compromised, though, according to what officers who worked for President Bill Clinton told ABC News two years ago.

Two retired officials spoke with ABC News to promote their books, and they claimed Clinton misplaced the codes that gave him access to the most powerful weapons on the planet.

“He thought he just placed them upstairs,” U.S. Air Force Lt. Col. Robert Patterson said at the time. “We called upstairs, we started a search around the White House for the codes, and he finally confessed that he in fact misplaced them. He couldn't recall when he had last seen them.”

U.S. Army Gen. Hugh Shelton, who served under Clinton as chairman of the Joint Chiefs of Staff, recalled the alleged incident, although his account took place two years after Patterson’s story.

Neither retired officer mentioned the Monica Lewinsky scandal, to which other media outlets have compared the Petraeus affair.