Key was aboard a ship that was anchored in the Patapsco River, near Fort McHenry, during the British attack. The British ships fired thousands of cannonballs and rockets at the fort, but the American flag still flew proudly over it the next morning. Key was so moved by the sight of the flag that he wrote a poem about it, which he called "Defence of Fort M'Henry."
Key's poem was set to music by John Stafford Smith, an English composer who had written the tune "To Anacreon in Heaven" for the Anacreontic Society, a men's social club in London. Smith's tune was already popular in the United States, and it was easy to sing, so "Defence of Fort M'Henry" quickly became a popular patriotic song.
In 1931, "Defence of Fort M'Henry" was officially designated as the national anthem of the United States. The song is now sung at patriotic events and sporting events across the country, and it is a symbol of American pride and unity.