During the British campaign against Washington, D.C., an elderly and respected physician, Dr. William Beanes was arrested for unfriendly acts toward the British soldiers which resulted in his arrest.
Francis Scott Key, a prominent lawyer and friend of Dr. Beanes was sent by President James Madison to obtain his release. Following negotiations, the British agreed to release Beanes. However, since the British were going to attack Baltimore, Maryland next, they would allow no one to go ashore.
The British landed soldiers on September 12 and engaged in a brisk land battle, however, they were not able to capture Baltimore. As part of a two pronged attack, the British now sent their naval fleet to attack and destroy the port city. The main defense of Baltimore harbor was Fort McHenry. For 25 hours the British fleet fired rockets and bombs at the fort.
The fort's defenders bravely withstood the bombardment and did not surrender. The British realized they could not take Baltimore without paying for it with heavy casualties. Since they were not willing to pay this price, they departed from Baltimore.
During the bombardment, Key was down river and while watching was inspired to write a poem that tells the story of the battle. When he reached Baltimore he finished the poem. Key wrote the poem to match the meter tobe sung to an old English tune To Anacreon in Heaven.
The song slowly grew in popularity and was well known and used by both sides during the Civil war. In later years it was very popular with the military and it was used as an "unofficial" national anthem. During World War I, the song became so widely accepted that a drive resulted in the Congress making it the National Anthem in 1931.
The National Museum of American History, which is part of the Smithsonian