Exactly 50 years ago, Apollo 13 set off from Earth and for the Moon. Just a couple of days later came a blast and the words that would shock and fascinate the world: "OK, Houston, we've had a problem here".

Nasa is marking the anniversary of the mission it refers to as a "successful failure", which represents one of its most high-profile disasters and its most famous miracles. It is a part of space history that is celebrated even today, with the story of the mission continuing to captivate the world.

It was 11 April that marked the day the astronauts blasted off on their way to the Moon, and 13 April that an oxygen tank explosion started the mission to save the astronauts from being stuck in space.

On 17 April, nearly exactly six days after the mission began, the astronauts fell back through the Earth's atmsosphere and arrived safely back on Earth. It was an unlikely end to an unlucky mission.

While it is now remembered as one of the most important moments in Nasa's history, the mission began in relative obscurity for a trip to the Moon. Apollo 11 had already managed to get to the lunar surface, and so what just a couple of years before was regarded as a near-impossibility was by that time relatively unexciting.

But hours later, television stations around the world were giving rolling updates on the mission's status, following closely as the astronauts and Nasa engineers back on Earth tried to save them from disaster.

As well as being a relatively unwatched mission, the first couple of days of the journey were almost tediously straightforward. After two days of flight, one of the Nasa staff in mission control joked the astronauts that the spacecraft was in such good shape that they were "bored to tears".

Problems began on Apollo 13 when the astronauts were nearing the Moon and heard a bang and felt a shudder through their spacecraft. During what should have been a routine stir, one of the oxygen tanks on the spacecraft had burst and exploded.

(After the mission was over, the explosion was traced back to overheating while the spacecraft was being tested on the ground, but there was no way to know that at the time.)

The explosion also knocked out the fuel cells that should have been powering the spacecraft, and sent voltage in its circuits plunging. Engineers watching the mission from Mission Control saw the pressure in the damaged oxygen tank drop instantly.

"OK, Houston, we've had a problem here," said Jack Swigert, the command module pilot who had actually joined the mission as a last-minute substitute for a colleague who had become sick just before the mission took off.

"This is Houston. Say again, please."

"Houston, we've had a problem," said Jim Lovell, the commander of Apollo 13.

Almost immediately, it became clear that the astronauts would not be landing on the Moon, as planned. But that was a relatively unimportant challenge compared with the more pressing job of staying alive.

In many ways, the explosion happened at the best possible time, and the astronauts would later say they considered themselves lucky. If it had happened earlier, they would have run out of power; later, and the blast could have happened in lunar orbit or on the surface of the Moon.

Nasa's groundbreaking decade of space exploration: In pictures Show all 10 1 /10 Nasa's groundbreaking decade of space exploration: In pictures Nasa's groundbreaking decade of space exploration: In pictures Mystic Mountain, a pillar of gas and dust standing at three-light-years tall, bursting with jets of gas from fledgling stars buried within, was captured by Nasa's Hubble Space Telescope in February 2010 Nasa/ESA/STScI Nasa's groundbreaking decade of space exploration: In pictures The first ever selfie taken on an alien planet, captured by Nasa's Curiosity Rover in the early days of its mission to explore Mars in 2012 Nasa/JPL-Caltech/MSSS Nasa's groundbreaking decade of space exploration: In pictures Death of a star: This image from Nasa's Chandra X-ray telescope shows the supernova of Tycho, a star in our Milky Way galaxy Nasa Nasa's groundbreaking decade of space exploration: In pictures Arrokoth, the most distant object ever explored, pictured here on 1 January 2019 by a camera on Nasa's New Horizons spaceraft at a distance of 4.1 billion miles from Earth Getty Nasa's groundbreaking decade of space exploration: In pictures An image of the Large Magellanic Cloud galaxy seen in infrared light by the Herschel Space Observatory in January 2012. Regions of space such as this are where new stars are born from a mixture of elements and cosmic dust Nasa Nasa's groundbreaking decade of space exploration: In pictures The first ever image of a black hole, captured by the Event Horizon telescope, as part of a global collaboration involving Nasa, and released on 10 April 2019. The image reveals the black hole at the centre of Messier 87, a massive galaxy in the nearby Virgo galaxy cluster. This black hole resides about 54 million light-years from Earth Getty Nasa's groundbreaking decade of space exploration: In pictures Pluto, as pictured by Nasa's New Horizons spacecraft as it flew over the dwarf planet for the first time ever in July 2015 Nasa/APL/SwRI Nasa's groundbreaking decade of space exploration: In pictures A coronal mass ejection as seen by the Chandra Observatory in 2019. This is the first time that Chandra has detected this phenomenon from a star other than the Sun Nasa Nasa's groundbreaking decade of space exploration: In pictures Dark, narrow, 100 meter-long streaks running downhill on the surface Mars were believed to be evidence of contemporary flowing water. It has since been suggested that they may instead be formed by flowing sand Nasa/JPL/University of Arizona Nasa's groundbreaking decade of space exploration: In pictures Morning Aurora: Nasa astronaut Scott Kelly captured this photograph of the green lights of the aurora from the International Space Station in October 2015 Nasa/Scott Kelly

But the astronauts now still needed to travel the 200,000 miles back to Earth, and do it without the oxygen or power they required for the journey. It would require them to slingshot around the Moon – coming frustratingly close to the surface they were supposed to land on – and then whip back around and float back home to Earth.

In the meantime, mission control got to work putting together a rescue plan while the astronauts on board attempted to put out of their mind just how likely it was they would now die in space, something they say they never discussed.

Flight controllers told the astronauts to shut down their command module and climb into Aquarius. That module was supposed to be the box that took the astronauts down to the lunar surface – but was refashioned into a lifeboat in an attempt to conserve power.

Because it was never meant for so many people for so long, the lander was low on space. It was also filled with carbon dioxide, as the astronauts breathed inside their new, tiny spacecraft.

One of the most famous breakthroughs came as engineers tried to find a way to fix that problem, by using the air purifiers from the now abandoned capsule in the lander. The two were the wrong shape to fit together – they were literally trying to fit a square canister into a round hole – but engineers back on Earth came up with a way of using various pieces of spacecraft to push the two together.

Even once that was fixed, conditions inside the lander were miserable, without the energy for heating or other improvements to their conditions. They were stuck inside of a frigid box that was never meant to hold them, stuck for days with little to do but wait and see if the various last-minute solutions to their desperate situation would actually work.

(The astronauts have said they didn't argue during this time, despite the miserable conditions, and didn't talk about the possibility of getting stuck floating in space and waiting to die either; Lovell wrote in his autobiography that they "were too busy struggling for survival". He also denied that they had poison pills hidden away in case of becoming lost.)

Eventually they arrived back near home for what is traditionally one of the most perilous parts of the journey: dropping back through Earth's atmosphere to come home. They had enough power to switch on the command module and wait as they went through the gruelling, hot ordeal of slamming back down to Earth.

As they did, the communications blackout that comes from the extreme conditions of the Earth's atmosphere lingered for much longer than usual, leaving flight controllers in the dark as to whether the three astronauts and their hacked-together spacecraft had survived.