In September of 1814, after occupying Washington, D.C. and burning the public buildings, a British invasion force proceeded to Baltimore - a busy port city that specialized in outfitting privateers to prey on British shipping.
Baltimore represented a more stategically important target than the largely undeveloped capital city of Washington, and was thus well protected by a masonry fort commanding the entrance to Baltimore harbor. After a 25 hour bombardment by the British fleet and determined resistance by the gunners of Fort McHenry, the invasion force was repulsed.
After two and a half years of indecisive campaigning on the Canadian frontier, America was in debt, weary of war, and facing a trained and disciplined European army. There was no hope of achieving the stated goals of the war: free trade, sailors' rights, and the annexation of Canada. But a victory at Fort McHenry offered hope that the War of 1812 might end on terms agreeable to the United States and that the American republic could endure.
The feeling of pride, patriotism, and hope emerging from the victory at Fort McHenry was recorded by Francis Scott Key, who witnessed the fort's American flag surviving the bomardment and recorded his impressions in the poem that became America's national anthem -"The Star Spangled Banner."