David Bowie once helped perhaps the most poignant ever rendition of his song Space Oddity get back onto YouTube.

Commander Hadfield posted his cover of the song, performed on board the International Space Station, in 2013. It became the first ever music video performed in space.

But it quickly ran into problems. Mr Bowie said that Commander Hadfield should be able to record and post the song, but it is owned by his publisher, who initially granted a licence for it to be used just for one year.

But following some legal wrangling and complications, Mr Bowie and his publisher came to an agreement that allowed the song to be used for another two years, taking the copyright to November 2016 and getting the song back onto YouTube.

Commander Hadfield said that he had made the video for a number of reasons, but “maybe most importantly, it was a chance to let people see where we truly are in space exploration”.

Mr Bowie himself posted on Facebook to say that the cover of his 1969 song was “possibly the most poignant version of the song ever created”.

For that reason, as soon as it was taken down, Commander Hadfield started working to get the cover back online. But the legal questions were complex — since the recording was made and posted from space, it wasn’t even clear which country’s laws and licenses the song was made under.

David Bowie: Life in pictures Show all 30 1 /30 David Bowie: Life in pictures David Bowie: Life in pictures David Bowie in 1960s Dezo Hoffman/Shutterstock David Bowie: Life in pictures Davy Jones; life before David Bowie Getty David Bowie: Life in pictures David Bowie in 1964 Dezo Hoffman/Shutterstock David Bowie: Life in pictures David Bowie 'In Mime' at the Middle Earth Club, London, 1968 Ray Stevenson/Shutterstock David Bowie: Life in pictures David Bowie in 1969 I T N/Shutterstock David Bowie: Life in pictures David Bowie performing his final concert as Ziggy Stardust at the Hammersmith Odeon, London, 1973 Getty David Bowie: Life in pictures David Bowie in 1973 PA David Bowie: Life in pictures David Bowie, with his wife Angela (Angie) and his son Zowie, after receiving an award for his latest record "Ziggy stardust" in Amsterdam, 1974 AFP David Bowie: Life in pictures David Bowie in the 1970s Sunshine/Shutterstock David Bowie: Life in pictures David Bowie poses with a pig David Bowie: Life in pictures David Bowie's son, Duncan Jones, confirmed his death on Twitter Duncan Jones/Twitter David Bowie: Life in pictures David Bowie in the 1980s Everett Collection/Rex David Bowie: Life in pictures David Bowie gives a press conference presenting the Japanese movie 'Merry Christmas Mr. Lawrence' directed by Nagisa Oshima, during the 36th International Film Festival in Cannes, 1983 AFP via Getty David Bowie: Life in pictures David Bowie performs on stage during a concert in La Courneuve, 1987 AFP David Bowie: Life in pictures David Bowie during his concert in West Berlin, Federal Republic of Germany, 1987 EPA David Bowie: Life in pictures David Bowie shakes hands with Princess Diana, 1993 PA David Bowie: Life in pictures David Bowie autographs copies of his newest album 'Outside' at the grand opening of a Herald Square music store 26 September 1995 in New York AFP/Getty David Bowie: Life in pictures David Bowie performs at the Panathinaikos stadium in Athens during a rock festival, 1996 Reuters David Bowie: Life in pictures David Bowie and his wife, supermodel Iman smile as they pose for photos after Bowie received a star on the world famous Walk of Fame 12 February in Hollywood, 1997 Getty David Bowie: Life in pictures David Bowie getting ready to perform 'Earthling' at the Phoenix Music Festival in 1997 Pat Pope/Shutterstock David Bowie: Life in pictures David Bowie on stage performing during the Tibet House Benefit Concert in New York City, 2001 Getty David Bowie: Life in pictures David Bowie Meltdown concert at the Royal Festival Hall, London, June 2002 Rex David Bowie: Life in pictures David Bowie performing during his concert at the Stravinski hall stage of the Montreux Jazz Festival, in Montreux, Switzerland, 2002 EPA David Bowie: Life in pictures David Bowie in 'Last Call with Carson Daly' TV programme taping in New York, 2003 Startraks/Shutterstock David Bowie: Life in pictures David Bowie walks with his with wife Iman and daughter Alexandria (2) in New York, 2003 Shutterstock David Bowie: Life in pictures David Bowie performs on stage on the third and final day of 'The Nokia Isle of Wight Festival 2004' at Seaclose Park, in Newport, UK Getty David Bowie: Life in pictures David Bowie and Kate Moss at the 2005 CFDA Awards dinner party at the New York Public Library in New York City, 2005 Getty David Bowie: Life in pictures David Bowie and model Iman arrive to the Metropolitan Museum of Art Costume Institute Gala, Superheroes: Fashion and Fantasy, held at the Metropolitan Museum of Art in New York City, 2008 Getty David Bowie: Life in pictures David Bowie anf Tilda Swinton at the MoMA's 6th Annual Film Benefit in New York, 2013 BFANYC.COM/Rex David Bowie: Life in pictures Flowers are left below a mural of David Bowie on the wall of a Morley's store in Brixton on 11 January 2016 Getty

But the cover was put back online, in part with the help of Mr Bowie, according to Commander Hadfield.

“We’re proud to have helped bring Bowie’s genius from 1969 into space itself in 2013, and now ever-forward,” Commander Hadfield wrote when the new deal was announced. He thanked a range of people including the Canadian Space Agency and Nasa — but passed his thanks “mostly to Mr David Bowie himself”.

Hadfield hasn’t publicly spoken about Mr Bowie’s death. But Tim Peake, who is on board the International Space Station at the moment, said that he was “saddened” by the news.