On May 25, 1961, the new American president, John F. Kennedy, stood in front of a joint session of Congress and called on the country to launch a bold initiative: “This nation should commit itself to achieving the goal, before this decade is out, of landing a man on the moon and returning him safely to the Earth.” Astronauts Neil Armstrong and Edwin “Buzz” Aldrin Jr. realized the first half of Kennedy’s aspiration when they planted their footprints on the desolate, gray lunar surface on July 20, 1969.

The second part of Kennedy’s goal—returning the men safely to the Earth—had yet to be fulfilled, however, as President Richard Nixon held an olive green phone to his ear and offered his congratulations to Armstrong and Aldrin from more than 200,000 miles away in what the White House called “an interplanetary conversation.” In spite of Nixon’s ebullience, though, NASA scientists and engineers knew that the most dangerous aspect of the mission was not landing on the moon, but getting off of it, and there were fears that the president may be forced just hours later to make two phone calls of a much different tenor.

Computer glitches, the failure of an ascent engine to ignite or an inability to dock with the orbiting command module captained by Michael Collins could have stranded Armstrong and Aldrin on the moon or in outer space with no possibility of rescue. Some even feared that the lunar dust on the astronauts’ spacesuits would spontaneously combust as soon as it contacted oxygen inside the lunar module. The Apollo program had already suffered a fatal mishap—three Apollo 1 crew members died in a cabin fire during a launch pad training exercise in 1967—and the possibility of another deadly accident remained a constant worry.

The mission’s danger became clear to Nixon’s staff a month before the launch of Apollo 11 when astronaut Frank Borman, the Apollo 8 commander who was assigned by NASA to be a liaison to the White House, called senior speechwriter William Safire. “You want to be thinking of some alternative posture for the president in the event of mishaps,” Borman said. Safire, later a New York Times, columnist, was still not clear on what the astronaut meant until he added, “Like what to do for the widows.”

White House Chief of Staff H.R. Haldeman told the speechwriter to develop a contingency plan and a presidential address in case tragedy struck and Armstrong and Aldrin were left marooned on the moon. Safire feared the undertaking would be a harbinger of bad luck, but he recalled the address that Dwight Eisenhower had drafted in case that D-Day failed and used it as inspiration.

Safire delivered his proposed doomsday speech in a July 18 memo to Haldeman with the title: “In Event of Moon Disaster.” If Armstrong and Aldrin were hopelessly stranded on the moon, Nixon would telephone “each of the widows-to-be.” Then, Nixon would address the nation and deliver a presidential eulogy that Safire hoped would never be read:

“Fate has ordained that the men who went to the moon to explore in peace will stay on the moon to rest in peace.

“These brave men, Neil Armstrong and Edwin Aldrin, know that there is no hope for their recovery. But they also know that there is hope for mankind in their sacrifice.

“These two men are laying down their lives in mankind’s most noble goal: the search for truth and understanding.

“They will be mourned by their families and friends; they will be mourned by their nation; they will be mourned by the people of the world; they will be mourned by a Mother Earth that dared send two of her sons into the unknown.

“In their exploration, they stirred the people of the world to feel as one; in their sacrifice, they bind more tightly the brotherhood of man.

“In ancient days, men looked at stars and saw their heroes in the constellations. In modern times, we do much the same, but our heroes are epic men of flesh and blood.

“Others will follow, and surely find their way home. Man’s search will not be denied. But these men were the first, and they will remain the foremost in our hearts.

“For every human being who looks up at the moon in the nights to come will know that there is some corner of another world that is forever mankind.”

The cadence and rhetorical flourish used by Safire to close the speech evoked the ending of “The Soldier,” a poem written by Englishman Rupert Brooke, who died in the Royal Navy in World War I: “If I should die, think only this of me/That there’s some corner of a foreign field/That is for ever England.”

Under the worst-case scenario, NASA planned to end communication with the men, leaving them to either run out of oxygen or commit suicide with no further earthly contact. Safire’s plan called for a clergyman to follow the same procedure as when sailors were buried at sea—commending their souls to “the deepest of the deep”—before ending with a recitation of the Lord’s Prayer.

Luckily, Safire’s memo was not needed as the astronauts returned safely. Few knew of the secret contingency plan until it became public in 1999, the 30th anniversary of Apollo 11’s moon landing, after Los Angeles Times reporter Jim Mann discovered it while conducting unrelated research at the National Archives. Aldrin read the prepared eulogy and later wrote, “I am proud to say that our mission accomplished the same goals—and brought us back home safely.”

HISTORY Vault: Moon Landing: The Lost Tapes

On the 50th anniversary of the historic moon landing, this documentary unearths lost tapes of the Apollo 11 astronauts, and explores the dangers and challenges of the mission to the moon.