An image of British musician Dawid Bowie

Germany on Monday thanked the late British music legend David Bowie for what it called his role in helping topple the Berlin Wall in 1989.

"Good-bye David Bowie. You are now among #Heroes. Thank you for helping to bring down the #wall," the foreign ministry said in a tweet with a link to a video of his Cold War-era anthem "Heroes" set in the then-divided city.

Bowie wrote "Heroes" while living in still war-ravaged Berlin for three years in the 1970s, when he was wearied by fame and trying to kick the drug and drink addictions.

While recording at the Hansa Studios in West Berlin, next to the border where East German guards had shoot-to-kill orders, he famously spied a couple locked in a passionate embrace.

The scene gave rise to the song's soaring lyrics, "I can remember/Standing by the wall/And the guns shot above our heads/And we kissed, as though nothing could fall", conjuring a world in which love and youth could conquer all divides.

He later played the song during a 1987 televised concert in front of the Reichstag building in West Berlin next to the Wall that drew hundreds of young East Berliners to rush to the border to listen to the superstar.

"I couldn't have made the music I did then if I hadn't been completely taken with Berlin, with its special structures and its tensions... the Wall and its impact on the city," Bowie told the Berlin daily Tagesspiegel in 2002 in a rare interview about his time in the city.

At the 25th anniversary celebrations of the Wall falling in November 2014, British singer Peter Gabriel was invited to sing a stripped-down version of "Heroes", sharing the stage with rock bands from east and west Germany and former dissidents.