Hundreds of people including Russian and US astronauts and top officials bid farewell on Tuesday to Alexei Leonov, a legendary Soviet cosmonaut who was the first man to perform a spacewalk.Thomas Stafford, an 89-year-old retired NASA astronaut, Valentina Tereshkova, the first woman to travel into space, and Russian Defence Minister Sergei Shoigu were among those gathered outside Moscow to pay their last respects to the Soviet space icon.Leonov was laid to rest at a military cemetery in Mytishchi in a ceremony that included a gun salute and a service by a Russian Orthodox priest.Ahead of the burial fellow astronauts took turns praising Leonov next to a flag-draped casket that bore his body.Stafford, who shared a historic space handshake with Leonov at the height of the Cold War in 1975, spoke fondly of the cosmonaut."Alexei, we will not forget you!" Stafford said in Russian.The two men took part in the groundbreaking Apollo-Soyuz mission that opened a new era of space cooperation between the Soviet Union and the US.Leonov was commander of the Soyuz 19 spacecraft and Stafford commanded the Apollo. Leonov also helped Stafford adopt two Russian boys.Soviet cosmonaut Tereshkova called Leonov a true friend."It's hard to come to terms with the fact that we have to say goodbye to you today," said the 82-year-old Tereshkova.'Irreplaceable loss'Russian cosmonaut Sergei Krikalev called him a "great patriot", while Leonov's friend, Lieutenant General Yury Babansky, said his passing was "an irreplaceable loss". "We said our goodbyes but we will remember as long as we live," he told AFP.Many ordinary Russians also came to pay their respects including students who skipped classes to attend the funeral."This is a loss for the entire Soviet people and the whole of mankind," Boris Yesin, who worked with Leonov at the Baikonur launch site in Kazakhstan, told AFP."Working with him was hard but interesting."On March 18, 1965, at the age of 30, Leonov made history when he left a spacecraft during the Voskhod 2 mission for a spacewalk that lasted 12 minutes and nine seconds.That spacewalk nearly killed him as his spacesuit became inflated due to the lack of atmospheric pressure. He had to bleed off some of the oxygen in his suit, risking oxygen starvation.His return to Earth also nearly ended in tragedy when Leonov and pilot Pavel Belyayev were forced to crash-land deep in the Russian woods.Russian President Vladimir Putin, who was on Tuesday in Abu Dhabi, last week sent his condolences to Leonov's widow and his daughter, calling him a "true trailblazer" and a "heroic person".Leonov became a legend at home and his feats were immortalised in cinema and literature. He was a friend of Yuri Gagarin, who became the first man in space in 1961 and trained with him.