WASHINGTON—Legendary astronaut John Young, who walked on the moon and later commanded the first space shuttle flight, has died, NASA said Saturday. Young was 87.

The space agency said Young died Friday night at home in Houston following complications from pneumonia.

NASA called Young one of its pioneers — the only agency astronaut to go into space as part of the Gemini, Apollo and space shuttle programs, and the first to fly into space six times. He was the ninth man to walk on the moon.

Acting NASA administrator Robert Lightfoot said in an emailed statement. “John was one of that group of early space pioneers whose bravery and commitment sparked our nation’s first great achievements in space.”

Young was the only astronaut to span NASA’s Gemini, Apollo and shuttle programs, and became the first person to rocket away from Earth six times. Counting his takeoff from the moon in 1972 as commander of Apollo 16, his blast-off tally stood at seven, for decades a world record.

He flew twice during the two-man Gemini missions of the mid-1960s, twice to the moon during NASA’s Apollo program, and twice more aboard the new space shuttle Columbia in the early 1980s.

His NASA career lasted 42 years, longer than any other astronaut’s, and he was revered among his peers for his dogged dedication to keeping crews safe — and his outspokenness in challenging the space agency’s status quo.

Chastened by the 1967 Apollo launch pad fire that killed three astronauts, Young spoke up after the 1986 shuttle Challenger launch accident. His hard scrutiny continued well past shuttle Columbia’s disintegration during re-entry in 2003.

“Whenever and wherever I found a potential safety issue, I always did my utmost to make some noise about it, by memo or whatever means might best bring attention to it,” Young wrote in his 2012 memoir, Forever Young.

He said he wrote a “mountain of memos” between the two shuttle accidents to “hit people over the head.” Such practice bordered on heresy at NASA.

Apollo 11 astronaut Michael Collins, who orbited the moon in 1969 as Neil Armstrong and Buzz Aldrin walked its surface, considered Young “the memo-writing champion of the astronaut office.” Young kept working at Johnson Space Center in Houston “long after his compatriots had been put out to pasture or discovered other green fields,” Collins wrote in the foreword of Forever Young.

Indeed, Young remained an active astronaut into his early 70s, long after all his peers had left, and held on to his role as NASA’s conscience until his retirement in 2004.

“You don’t want to be politically correct,” he said in a 2000 interview with The Associated Press. “You want to be right.”

Young was in NASA’s second astronaut class, chosen in 1962, along with the likes of Neil Armstrong, Pete Conrad and James Lovell.

Young was the first of his group to fly in space: He and Mercury astronaut Gus Grissom made the first manned Gemini mission in 1965. Unknown to NASA, Young smuggled a corned beef sandwich on board, given to him by Mercury astronaut Wally Schirra. When it came time to test NASA’s official space food, Young handed Grissom the sandwich as a joke.

The ensuing scandal over that corned beef on rye — two silly minutes of an otherwise triumphant five-hour flight — always amazed Young. Sandwiches already had flown in space, Young said in his book, but NASA brass and Congress considered this one a multimillion-dollar embarrassment and outlawed corned beef sandwiches in space forever after.

Two years later, with Gemini over and Apollo looming, Young asked Grissom why he didn’t say something about the bad wiring in the new Apollo 1 spacecraft. Grissom feared doing so would get him fired, Young said. A few weeks later, on Jan. 27, 1967, those wires contributed to the fire that killed Grissom, Edward White II and Roger Chaffee in a countdown practice on their Cape Canaveral launch pad.

It was the safety measures put in place after the fire that got 12 men, Young included, safely to the surface of the moon and back.

“I can assure you if we had not had that fire and rebuilt the command module ... we could not have done the Apollo program successfully,” Young said in 2007. “So we owe a lot to Gus, and Rog and Ed. They made it possible for the rest of us to do the almost impossible.”

Young orbited the moon on Apollo 10 in May 1969 in preparation for the Apollo 11 moon landing that was to follow in a couple months. He commanded Apollo 16 three years later, the next-to-last manned lunar voyage, and walked on the moon.

He hung on for the space shuttle, commanding Columbia’s successful maiden voyage in 1981 with co-pilot Robert Crippen by his side. It was a risky endeavour: Never before had NASA launched people on a rocket ship that had not first been tested in space. Young pumped his fists in jubilation after emerging from Columbia on the California runway, following the two-day flight.

Crippen called flying with Young “a real treat.”

“Anybody who ever flew in space admired John,” said Crippen, a close friend who last spoke to him a few months ago.

Young made his final trek into orbit aboard Columbia two years later, again as its skipper.

Loading... Loading... Loading... Loading... Loading... Loading...

Young’s reputation continued to grow, even after he stopped launching. He spoke out on safety measures, even before the Challenger debacle.

“By whatever management methods it takes, we must make Flight Safety first. If we do not consider Flight Safety first all the time at all levels of NASA, this machinery and this program will NOT make it,” he warned colleagues.

As then chief of the astronaut corps, Young was flying a shuttle training aircraft high above Kennedy Space Center when Challenger ruptured. He took pictures of the nosediving crew cabin. The seven Challenger astronauts never knew of all the dangerous O-ring seal trouble leading up to their flight. “If I had known these things, I would have made them aware, that’s for damn sure,” Young wrote in his book.

Young noted that even his friends at NASA considered him “doom and gloom,” and that a shuttle launch “always scared me more than it thrilled me.”

He always thought the probability was there for a space shuttle accident, he observed in his autobiography, given that it was “such an incredibly complex machine.”

“It wasn’t pessimism. It was just being realistic,” he wrote.

Yet Young maintained that NASA and the nation should accept an occasional space flight failure, saying it’s worth the risk.

“I really believe we should be operating (the shuttle), flying it right now, because there’s just not a lot we can do to make it any better,” Young said in 2004, a year after the Columbia tragedy. Another year passed before shuttle flights resumed.

Throughout the 1990s and into the 2000s, Young maintained the United States should be doing two to three times the amount of space exploration that it was doing. NASA should be developing massive rockets to lift payloads to the moon to industrialize it, he said, and building space systems for detecting and deflecting comets or asteroids that could threaten Earth.

“The country needs it. The world needs it. Civilization needs it,” Young said in 2000, adding with a chuckle, “I don’t need it. I’m not going to be here that long.”

In his book, Young noted that his “relentless” stream of memos about volcanic super-eruptions and killer asteroids was aimed at scaring and educating at the same time. Humans need to start living off the planet in order to save the species, he stressed again and again, pointing to the moon. “Some folks surely regarded me as a crackpot,” he wrote. “But that didn’t stop me.”

Young spent his last 17 years at NASA’s Johnson Space Center in Houston in management, focusing on safety issues. He retired at the end of 2004, seven months shy of NASA’s return to space following the Columbia accident.

Young was born Sept. 24, 1930 and grew up in Orlando, Fla. He became interested early on in aviation, making model planes. He spent his last high school summer working on a surveying team. The job took him to Titusville due east of Orlando; he never imagined that one day he would be sitting on rockets across the Indian River, blasting off for the moon.

He earned an aeronautical engineering degree from Georgia Institute of Technology in 1952 and went on to join the Navy and serve in Korea as a gunnery officer. He eventually became a Navy fighter pilot and test pilot.

Young received more than 100 major accolades in his lifetime, including the prestigious Congressional Space Medal of Honor in 1981.

Even after leaving NASA, he worked to keep the space flame alive, noting in his official NASA biography that he was continuing to advocate the development of technologies “that will allow us to live and work on the moon and Mars.”

“Those technologies over the long (or short) haul will save civilization on Earth,” he warned in his NASA bio, almost as a parting shot.

This story has been corrected to clarify that Robert Lightfoot is acting NASA administrator.