In 1852, Costa Rica did not have a national anthem. However, when the United States and the United Kingdom accredited their diplomatic representatives in Costa Rica, President Juan Rafael Mora Porras, wanted to host a welcome ceremony for the missions. A decision was made that a national anthem for Costa Rica should be composed for the occasion, and the president requested Mr. Manuel María Gutiérrez, Director of the Costa Rican National Army Orchestra, to compose the music. It was told that Mr. Gutierrez would be incarcerated for a month if he refused.
Unfortunately Don Manuel Maria Gutierrez ran out of time and as a consequence was imprisoned at the Cuartel de Armas, where he looked through a small window out onto the Plaza Mayor. Feeling inspiration, he was able to finish the composition and on the 11 of June, 1852, at the Palacio Nacional, the national anthem of Costa Rica was heard for the first time alongside those of the United States and England.
In 1903, a contest was held for composing the lyrics to the anthem, which was won by José María Zeledón Brenes. Despite having the words and anthem officially composed and in common use, they were not declared as the official national anthem until 1949.