This song has been used wholly or partially as the national anthem of Germany since 1922. Austrian composer Joseph Haydn (1732-1809) wrote the music in 1797, during the Napoleonic wars as an anthem for the birthday of the Austrian Emperor Francis II. As "Gott erhalte Franz den Kaiser"(God Save Franz the Emperor), it was first performed on the Emperor's birthday, February 12, 1797 and the song subsequently became Austria's national anthem. New words were set to the music in 1841 by a German poet, August Heinrich Hoffmann, and his "Das Lied der Deutschen," (The Song of the Germans) was considered revolutionary at the time. In order to endorse its republican and liberal tradition, the tune was chosen as the national anthem of Germany in 1922, during the Weimar Republic. By now the song was being titled "Deutschland, Deutschland uber Alles," (Germany, Germany over All). Other patriotic tunes supplemented it after the Nazi party took control of the government. After the fall of Adolf Hitler, Germany had no national anthem until 1950, when the West German government re-adopted Haydn's tune. Upon German reunification in 1990, it was confirmed as the national anthem, with only the third stanza sung on official occasions.
The melody, along with several variations, is also the second movement of one of Haydn's most famous string quartets, his string quartet Op. 76 No. 3, nicknamed the "Emperor Quartet."
Haydn was particularly fond of his creation. In his frail old age, the composer often would struggle to the piano to play this song, as a form of consolation, and according to his servant Johann Elssler, it was the last music Haydn ever played. He later recounted (as quoted in Robbins Landon and Jones' Haydn, His Life and Work): "The 'Kayser Lied' was still played three times a day, though, but on May 26th  at half-past midday the Song was played for the last time and that 3 times over, with such expression and taste, well! that our good Papa was astonished about it himself and said he hadn't played the Song like that for a long time and was very pleased about it and felt well altogether till evening at 5 o'clock then our good Papa began to lament that he didn't feel well."