It is believed that the lyrics were written for the cornerstone-laying ceremony of the Independence Gate in Seoul in 1896 by Yun Chiho, a politician, or by An Chang-ho, a pro-independence leader and educator. Initially, Aegukga was sung to the tune of the Scottish folk song "Auld Lang Syne", introduced to Korea by Western missionaries. The Provisional Government of the Republic of Korea (1919–1945) in Shanghai, China, adopted it as their national anthem. At a ceremony celebrating the founding of South Korea on 15 August 1948, the Scottish tune was finally replaced by the Finale of Korea Fantasia that Ahn Eak-tai had composed in 1935. The new "Aegukga" was later adopted by the Presidential Decree of 1948 by then-President Syngman Rhee (or Lee Seungman).
Since the composer Ahn Eak-tai died in 1965, the copyright for the music will not expire at least until 2015. Two Korean professional soccerteams were sued by a copyrightholders' group for public playing of this song in December 2003. The composer's widow Lolita Ahn and her family then relinquished all rights to Aegukga to the Korean government on 16 March 2005. The lyrics, written in the 19th century, are in the public domain.