Fifty years ago, a fire broke out during a test of the rocket that would take men to the Moon. Three astronauts died on the launch pad – but their deaths were not in vain.

22 January 1967, Cape Canaveral, Florida

One of Nasa’s most celebrated astronauts, Lt Col Virgil ‘Gus’ Grissom was becoming increasingly frustrated with his latest mission. He had every reason to be angry.

A former fighter and test pilot, Grissom was the second American to launch into space (the third overall). In March 1965, he became the first astronaut to return to space as commander of Nasa’s new two-man Gemini spacecraft. A year later, he was selected as the first commander of Apollo – the spacecraft being designed to eventually take a crew to the lunar surface and return them safely to Earth.

If all went to plan, Grissom would be in line to lead a mission to the Moon. Right now, however, even getting Apollo 1 off the ground was proving a challenge.

“The flight had been plagued with problems,” says Gerry Griffin, a guidance navigation and control systems officer – later a flight director – for the Apollo missions. “When the Apollo 1 spacecraft was delivered to Cape Canaveral, it was not in a good shape and they had to do a lot of work to get it ready.”

The Apollo missions were planned in two stages. Apollo 1 was the first manned mission in the ‘Block 1’ programme. Built by North American Aviation, it was designed to test a crew of three and a multitude of new spacecraft systems in orbit around the Earth. Apollo spacecraft capable of carrying astronauts to the Moon would be built in ‘Block 2’.

“This was a hugely complicated spacecraft compared to anything they’d built before,” says Allan Needell, Apollo Curator at the National Air and Space Museum in Washington DC. “There was a lot of testing and going back and forth, some of the work was substandard.”

There were deficiencies in the wiring, leakages of coolant, failures in the life support system and glitches with the radios  

In fact there were deficiencies in the wiring, leakages of coolant, failures in the life support system and glitches with the radios. “They were having problems with quality control, problems with deadlines, problems with testing,” says Needell. “By the time [the Apollo 1 capsule] was built they were having communications problems – it was bedeviled with issues.”

Even the astronauts themselves thought the capsule was a lemon. On 22 January, Grissom had a short break from training and returned to his home in Houston. Before he left, he plucked a lemon from the tree growing in his front yard. Back at Cape Canaveral, he hung it outside the hatch of the Apollo 1 simulator. The Apollo programme was not in good shape.

13:00 27 January 1967, Launch Complex 34

The “Plugs-Out Integrated Test” was designed as a full simulation of the Apollo launch, overseen from both the control centre at Cape Canaveral and mission control in Houston. The only difference between this and a real launch would be that the Saturn rocket beneath the crew was empty of fuel.

“It was a full-up dress rehearsal, we were fully manned,” says Griffin, who was at his console in Houston. “We counted down to zero, it was very realistic.”

As commander, Grissom entered the command module first and took his place in the left-hand seat. Roger Chaffee was next, with the seat on the right, followed by Ed White, who, as command module pilot, took the centre couch. White had distinguished himself during Gemini 4  in 1965, when he had become the first American to walk in space. A highly qualified naval pilot, Chaffee was the only rookie astronaut on the crew.

Almost as soon as they had settled into their seats, the test ran into problems. As the crew hooked their spacesuits up to the oxygen supply, Grissom reported a sour smell “like buttermilk” and the simulated count was held so samples could be taken and analysed. With nothing seemingly wrong with the air supply, an hour and 20 minutes later, the spacecraft hatch was finally sealed shut.

This complex hatch was made up of three sections – an inner section to seal the spacecraft, a heatshield door and a further door on the cowling. This outer part would be jettisoned after launch. It took several minutes to get the whole arrangement in place and secured.

Almost as soon as they had settled into their seats, the test ran into problems

As countdown resumed, the air in the capsule was replaced with pure oxygen. The oxygen was maintained at higher pressure inside the capsule than outside. This simulated the increased pressure of the spacecraft in orbit and allowed the astronauts to breathe comfortably.

Both the single-man Mercury and two-man Gemini capsules had followed the same procedure without incident. It was so routine that the safety manual for testing the spacecraft made no reference to the hazards of strapping a crew into an experimental space capsule in a pressurised oxygen environment.

17:40, Apollo 1 spacecraft

There had been problems all day with communications between the ground and spacecraft, which was only a few hundred metres away from the control centre on the launch pad. As the countdown continued and more systems were switched across to Apollo 1, at times it was impossible to make out what the astronauts were saying. “I remember Gus Grissom got very exasperated,” recalls Griffin. “He was really mad.”

“Jesus Christ,” Grissom exclaimed. "How are we going to get to the Moon if we can't talk between two or three buildings?"

After more than four-and-a-half hours bunched-up on their couches in the cramped spacecraft, the count was once again put on hold as the crew attempted to troubleshoot the communications system and isolate the problem.

Finally, at 18:10, the countdown was held at T-10 minutes, ready for the final transfer to internal power.

18:31, 17:31 local time, mission control Houston

“They stopped to fix the comm problems and we all stood up and most people went to take a break,” says Griffin. “For some reason I left my headset on and I heard a noise, kind of a static, then a quiet period of a second.”

“Then,” he says, “I heard the word ‘fire’ from the crew and that was about all.”

Guidance officer, Manfred ‘Dutch’ von Ehrenfried, was at a nearby console. “We couldn’t believe what we were hearing,” he says. “Did you hear what I hear? Did you hear that?”

It took us several minutes to figure out there had been a fire in the spacecraft – Gerry Griffin, Nasa  

“I yelled at a couple of the guys,” says Griffin. “Hey, there’s something going on!”

“I thought it might have meant a pad fire down on the ground or something,” he says. “Then as one thing led to another, everyone came back in and it took us several minutes to figure out there had been a fire in the spacecraft.”

18:31 Cape Canaveral, Apollo 1 spacecraft

“Fire, I smell fire,” the first indication from the capsule that something was wrong. It is unclear whether the voice is Chaffee or White. “Fire in the cockpit.”

Within seconds the fire had broken from its point of origin, stretching in a wall of flames along the left side of the module. The flames rose vertically and spread across the cabin ceiling, scattering beads of molten nylon from straps and fastenings onto the crew.

The next communication is indistinct, the only words that can be made out with any certainty are “bad fire.” The transmission ends with a cry of pain.

Fifteen seconds after the first report of fire, TV cameras on the pad show flames filling the command module.

“Then you hear the pad people try to rescue the crew,” says Ehrenfried. “Then it starts to sink in, this is really bad and we didn’t know how bad until we heard on the communications loop: ‘We’ve lost them’.”

02:00, 28 January 1967

Seven-and-a-half hours after the fire, the ground crew finished lifting the remains of the crew from the capsule and work began on sifting through the wreckage for the source of the fire. The interior of the spacecraft resembled an incinerator – every surface was charred, blackened or melted. In their efforts to rescue the crew, 27 men on the launchpad also had to be treated for smoke inhalation and two were admitted to hospital.

Despite the potential conflict of interest, Nasa was given the go-ahead to carry out its own internal investigation into the cause of the disaster, without outside political interference.

“The comparison with the Challenger accident years later is interesting,” says Needell. “The head of Nasa, James Webb, said Nasa was best qualified to do it and could do it faster, better and more efficiently than anyone else. [President] Johnson shook his hand and said that was good enough for him.”

The investigation board included astronaut Frank Borman, one of the world’s most experienced astronauts who had recently completed a 14-day mission in Gemini 7. Griffin was assigned to Borman’s team to examine failings in the Apollo spacecraft design.

Apollo 1 was gradually taken apart to try to isolate the cause of the disaster but no single ignition source was identified. “To this day we don’t know what started the fire,” says Griffin. “Temporary wiring had been put in the spacecraft and it could have been a short or a spark.”

Needell agrees that the high-pressure oxygen in the capsule was the primary cause of the disaster  

“What we learned that day,” Griffin adds, “is you can burn almost anything in a pure oxygen environment if you get a source to start it.” And once lit, there were plenty of combustible materials in the capsule to feed the fire, including stacks of paper checklists, Velcro fastenings and nylon netting.

Needell agrees that the high-pressure oxygen in the capsule was the primary cause of the disaster. “That’s what they did in Mercury and Gemini and they were very lucky, nothing ever happened,” he says. “The amount of wiring and things that could go wrong inside Apollo were hundreds of times greater.”

April 1967

Just three months after the accident, the investigation report into the Apollo 1 fire was published. Although it never identified the exact cause of the blaze, it listed deficiencies in design, manufacture, installation and quality control as well as management and testing failures.

There was some consolation to be had in the conclusion that the astronauts had lost consciousness and died from inhaling toxic gases within seconds of reporting the fire. The board concluded that because the door of the capsule opened inwards, the cabin pressure meant the crew had no chance of forcing the hatch open and escaping.

Recommendations included redesign of the spacecraft, improved quality control and new procedures for testing and emergencies. “We came out of it with a much better and safer spacecraft,” says Griffin. “It was a tragic event but we got through it and figured out what happened to make it better.”

Needell agrees: “As a result of the fire, they went back and revisited every single design and procedure to examine contributions to the fire,” he says. “Apollo became much more reliable than it would have been otherwise.”

Apollo 1 was to be the last time a pure oxygen environment was used in a capsule on the ground. In future spacecraft, the crew would breathe an oxygen and nitrogen mixture on the launchpad and pure oxygen only in space, where oxygen is far less of a hazard. Because there is almost no convection in microgravity, fire in space spreads slower than on the ground and is therefore easier to contain.

Apollo 1 was a tragic event and we lost three really good friends, but it may have saved the programme – Gerry Griffin  

Within months of an event that could have completely grounded the dream of landing a man on the Moon, the Apollo programme was back on track. No crew ever flew in a Block 1 spacecraft, but on 11 October 1968, the first manned mission, Apollo 7, blasted off into orbit for a test of the new Block 2 command and service module. Just over two months later, Borman led the crew of Apollo 8 on a mission to orbit the Moon. Seven months after that, Neil Armstrong set foot on the lunar surface.

“Apollo 1 was a tragic event and we lost three really good friends,” says Griffin, “but it may have saved the programme.”

“If we’d had something like that happen on the way to the Moon,” he adds, “it probably would have ended.”

January 2017

Grissom and Chaffee are buried close to each other in the Arlington National Cemetery in Washington DC. White is interred in the cemetery at West Point Military Academy in New York state. A small plaque commemorating their mission is fixed to the concrete remains of launch complex 34 at Cape Canaveral.

Shortly after the fire, the Apollo 1 spacecraft itself was moved to Nasa’s Langley facility in Virginia. It remains there today, still disassembled and secured in a climate-controlled container.

Looking back on the state of the Apollo programme in January 1967 – the flaws in the capsule and failures in quality control and safety procedures – the loss of the three astronauts seems almost inevitable. But it could have been far worse. Many more people would likely have died if the accident took place with a fully fueled rocket underneath.

Two Nasa crews have been lost in spacecraft since the fire. In 1986, seven astronauts were killed when Space Shuttle Challenger exploded shortly after launch. In 2003 another seven died when Columbia disintegrated on re-entry. Although lessons were learnt from both disasters, with new space capsules such as Orion being designed, the Apollo 1 tragedy remains as relevant today as it did 50 years ago.

If we can put a man on the Moon, why can’t we solve the energy crisis? Or cure cancer? – Allan Needell, Smithsonian Air & Space  

“The higher quality control and management procedures carry forward,” says Needell. “The Orion spacecraft Nasa’s developing now is reverse engineering a lot of lessons learnt from the Apollo era,” he says. “I would be absolutely astonished if there weren’t aspects of Orion which mimic changes that were made as a result of the fire.”

There is also a deeper cultural legacy of Apollo, of which the tragedy of Apollo 1 is a part. “The Apollo programme has become a symbol for a time of ‘can do’,” says Needell. “If we can put a man on the Moon, why can’t we solve the energy crisis? Or cure cancer? It’s taken on this symbolic meaning of a time when collective action could be organised and leadership trusted to focus on a hardly-achievable goal like landing man on the Moon.”

It is important that we continue to learn the lessons from failures and push on in our exploration beyond the Earth. Before he died, Grissom had begun writing his memoirs of the space programme.

“If we die, we want people to accept it,” he wrote. “We're in a risky business, and we hope that if anything happens to us it will not delay the program. The conquest of space is worth the risk of life."

Join 800,000+ Future fans by liking us on Facebook, or follow us on Twitter, Google+, LinkedIn and Instagram

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.