“Zdravljica” was written by France Prešeren, considered as Slovenia’s national poet, as a drinking song (in his original manuscript, the layout of the words resemble a wine glass), but also was seen as politically charged piece when it was written in 1844 as it spoke of pan-Slavic nationalism, which was controversial in Austria-Hungary (which Slovenia was part of at the time). It was finally published in 1848, after revolutions in Austria-Hungary lifted the censorship.
In 1905, Zdravljica was set to music for the first time, the entire poem had a choral composition composed for it by Stanko Premrl, and this was the composition chosen as the Slovenian anthem in September 1989. The constitution of Slovenia, adopted on December 23, 1991, does not specify a specific verse and just states that “Zdravljica” is the national anthem. The 1994 act regulating the flag, anthem, and other symbols states that is is just the seventh verse that is the anthem, and in government publications and in practice, only the seventh verse (as also presented here) is the anthem.