In 1814, Francis Scott Key did not set out to write a national anthem for the United States. Instead, he was just writing a poem to express his pride and his joy at the successful defense of Baltimore by the garrison of Fort McHenry.
Key had been involved in a relatively small way in the military aspect of the War of 1812. However, his writing of the song came about more because of his legal practice and his reputation for eloquence. He was asked to go to the British to negotiate for the release of a prominent doctor from a town in Maryland, near Washington, D.C. Key, the doctor, and a few others were then kept aboard a British warship because the British were planning to attack Baltimore and they did not want to let Key and the others go and spread the word.
From the deck of the British ship, a few miles from the fighting, Key watched as the British tried to use their artillery to destroy Fort McHenry, which they had to destroy in order to enter Baltimore harbor. The only way they could see for sure if the fort was still holding out was by looking for the large flag that flew there. In the morning, after an all-night fight, Key and the others looked to see if “our flag was still there.” When it was, he was moved enough to write a few lines on the spot. He completed the poem and set it to music within days.
Key’s aim, then, was simply to write a poem that expressed his feelings on seeing that Fort McHenry had withstood the assault and Baltimore was safe.