School children unfold a 30-by-42-feet American flag at Fort McHenry, a star-shaped fort which during the War of 1812 successfully defended Baltimore’s harbor from an attack by the British navy. (Astrid Riecken/FOR THE WASHINGTON POST)

And the rockets’ red glare, the bombs bursting in air,

Gave proof through the night that our flag was still there

You know the words above. You’ve sung them before a baseball game or at a swim meet. They’re part of our national anthem, also called “The Star-Spangled Banner.” You probably also know that Francis Scott Key wrote them. But do you know when and why? Key’s inspiration was a battle during the War of 1812, which started 200 years ago this month. It’s often called “the forgotten war” because it isn’t studied much in school. But the War of 1812 played a big role in helping the United States grow up and become more than just a collection of states.

Why go to war?

Not long after the United States had gained its independence from Britain, America got caught between Britain and France as those countries battled to become the greatest world power. The United States wanted to sell its goods to both countries, but each side wanted to stop the trade with the other. Britain, with its large navy, blocked U.S. ports and captured U.S. ships being used for trade. Sometimes Americans were taken off those ships and made to serve in the British navy. Britain also was working with Native American tribes to stop the United States from expanding into the area west of the Mississippi River.

The first printed version of Francis Scott Key’s “Defence of Fort McHenry” from 1814. You probably know it as “The Star-Spangled Banner.” (Maryland Historical Society)

Some American leaders, including President James Madison, wanted to declare war on Britain, mostly to protect the United States’ freedom to sail the seas. Others wanted to fight both Britain and France. Near the Mississippi River, many people wanted war so the British would stop helping Native Americans. But in New England, a powerful and wealthy part of America, the state governments didn’t want war at all. Fighting would cause more problems, they said, than it would solve.

Even though the country was divided, Congress voted to declare war on Britain, which it considered a bigger threat than France. So on June 18, 1812, the United States, with its tiny military, began a 21 / 2-year battle with the world’s largest naval power. Luckily for the United States, Britain had to give most of its attention to its war with France.

Where was the battlefield?

In the early months of the war, a lot of fighting took place in and near Canada, which was a British colony. The United States attacked three parts of Canada and suffered lopsided defeats. The Americans lost the city of Detroit and other parts of the Michigan territory. The only good news came from the USS Constitution. The ship, which earned the nickname “Old Ironsides” when British cannonballs hit her but did little damage, defeated the British ship Guerriere in August 1812. The victory helped rally American spirits and persuade Congress to spend $2.5 million — about $34 million in today’s dollars — to build more warships.

In the fall of 1812, the British began stopping more ships from leaving and entering ports along the East Coast and the Gulf of Mexico. Then they burned towns along the Chesapeake Bay. The Americans had victories, including Commodore Oliver Hazard Perry’s defeat of six British ships at the Battle of Lake Erie in September 1813. But the fighting dragged on.

Focus on the flag

The British hit the U.S. government hard in August 1814. Troops marched into Washington and set half a dozen buildings — including the President’s House (now called the White House) and the Capitol — on fire. People in Baltimore were worried that their city, which built many ships used in the war, would be next.

Less than a month later, the British sent a fleet of ships toward Baltimore to destroy what they called a “nest of pirates.” At the time, the United States had given permission for ship owners — they were called “privateers,” but the British considered them pirates — to raid British trading ships as part of the war effort. But first, the British had to get past Fort McHenry. So they bombed the fort for 25 hours.

A young lawyer named Francis Scott Key watched the battle from a nearby ship, where he was being held. When the smoke cleared on the morning of Sept. 14, 1814, he saw the 15 stars and 15 stripes flying over the fort and was thrilled that “our flag was still there.” He wrote a few lines of a song that later became “The Star-Spangled Banner.”

How it ended

By then, both sides wanted to end the war, which had become very expensive. The United States sent negotiators to Europe to work out a peace treaty. After months of talks, both sides signed the Treaty of Ghent in Belgium. Canada’s border and Indian territories went back to where they were before the war. Britain ended the blockades but wouldn’t agree to stop grabbing sailors off American ships. So it wasn’t a clear victory or defeat for either side.

What the United States did gain was a sense of pride. The new nation that took on the world’s greatest military power had stood its ground. Symbols of patriotism — the flag and “The Star-Spangled Banner” — became hugely popular. America wasn’t yet the land where everyone was free, but it had shown the world that it was indeed the home of the brave.

Christina Barron