Francis Scott Key wrote the lyrics after witnessing the British bombardment of Fort McHenry in Baltimore during the War of 1812.