The codes needed to launch a US nuclear strike are supposed to be kept close to the president at all times.

A department within the Defense Department is tasked with overseeing all aspects of the nuclear-launch process, including the codes.

During Bill Clinton's presidency, officials from that department discovered the codes had gone missing.

The process the president has to go through to launch the US's nuclear weapons isn't as simple as pressing a button, but the key component of that process — the codes needed to authorize the launch — are never far from the president.

At least they're never supposed to be.

According to Gen. Hugh Shelton, who was chairman of the Joint Chiefs of Staff from October 1997 to September 2001, the number of redundancies in the nuclear-launch process "is staggering." All of steps are "dependent on one vital element without which there can be no launch," he wrote in his 2010 autobiography, "Without Hesitation: The Odyssey of an American Warrior."

That element, the president's authorization codes, is supposed to remain in close proximity to the president at all times, carried by one of five military aides, representing each branch of the military. The codes are on a card called the "biscuit" carried within the "football," a briefcase that is officially known as the "president's emergency satchel."

President Bill Clinton, with Defense Secretary William Cohen, left, and Chairman of the Joint Chiefs of Staff Gen. Henry "Hugh" Shelton, in Washington, DC, September 15, 1998. (AP Photo/J. Scott Applewhite)

However, around 2000, according to Shelton, a member of the department within the Pentagon that is responsible for all pieces of the nuclear process was dispatched to the White House to physically look at the codes and ensure they were correct — a procedure required to happen every 30 days. (The set of codes was to be replaced entirely every four months.)

That official was told by a presidential aide that President Bill Clinton did have the codes, but was in an important meeting and could not be disturbed.

The aide assured the official that Clinton took the codes seriously and had them close by. The official was dismayed, but he accepted the excuse and left.

When the next inspection took place the following month, that official was on vacation, according to Shelton, and another official was dispatched to the White House. The new official was met with the same excuse — the president is very busy, but takes the codes very seriously and has them on hand.

"This comedy of errors went on, without President Clinton's knowledge I'm sure, until it was finally time to collect the current set and replace them with the new edition," Shelton writes.

"At this point we learned that the aide had no idea where the old ones were, because they had been missing for months," he added. "The President never did have them, but he assumed, I'm sure, that the aide had them like he was supposed to."

A military aide, carrying the "football" containing launch codes for nuclear weapons, accompanies President Donald Trump in Washington, DC, February 3, 2017. Reuters

Shelton and then-Secretary of Defense William Cohen were alarmed. The problem of missing codes had been resolved by changing the codes, but they quickly acted to change the process itself, mandating that the Defense Department official visiting the White House physically see the codes — waiting there to do so if necessary.

Shelton and Cohen feared the saga would reach the press and become an embarrassing story. But word of the missing codes never made it out, and Shelton's recounting of it in his 2010 book was, to his knowledge, the first time it had been shared publicly.

"This is a big deal — a gargantuan deal — and we dodged a silver bullet," Shelton writes, adding: "You do whatever you can and think you have an infallible system, but somehow someone always seems to find a way to screw it up."