On the Fourth of July, Americans who celebrate with myriad renditions of “The Star-Spangled Banner” may well know that the lyrics were the handiwork of Francis Scott Key, who composed his immortal poem while watching the Battle of Baltimore.
But fewer people are likely to know what led Key – who was a lawyer, not a soldier – to witness the battle in the first place.
The answer comes down to the saga of one Maryland doctor.
In late August of 1814, the British had marched to the American capital and also invaded Maryland. When they made their way to the town of Upper Marlboro, which had been largely abandoned, they found one Dr. William Beanes, the town’s primary landowner and a patriarchal figure in the community, who had elected to remain, according to Harold D. Langley in the Encyclopedia of the War of 1812.
When the British arrived, Dr. Beanes greeted them as friends, and even offered up his estate as a makeshift headquarters for British officers, who accepted the offer. Even though the U.S. had been independent for nearly 40 years, there were still British sympathizers in the region. The men likely figured that the doctor was either a sympathizer or merely a hospitable gentleman who treated high-ranking officers, be they American or British, with the respect their position commanded.
Their time together had been amicable. But a few days after the officers departed, word reached Dr. Beanes that British soldiers were looting the abandoned farms of his neighbors. The doctor formed a small posse of Maryland residents to round up these roguish soldiers and held them in a local jail. One of the detainees managed to escape—and he went straight to his leaders to tell them about the Dr. Beanes posse.
Get your history fix in one place: sign up for the weekly TIME History newsletter
The British officers felt betrayed that the doctor they had spent time with had chosen to treat their soldiers in such fashion. So, in the middle of the night, “a party of British horsemen rode up to Beanes’ front door, crashed into the house, and pulled the doctor out of bed,” as narrated in Walter Lord’s book The Dawn’s Early Light, which adds that the British Major-General, Robert Ross, “normally the most humane of warriors, had nothing but contempt for the old doctor,” and that the Royal Navy Admiral, George Cockburn, wanted to send him “in chains” all the way to the British prisoner-of-war camp in Nova Scotia.
Taken into British custody, the doctor —despite being a gentleman of 65— was brought to the Royal Navy ship, the HMS Tonnant, and thrown in the brig. Such treatment of a prominent citizen was unusual in that era.
Fortunately for Dr. Beanes, he was a well-liked and well-connected man, whose seizure and incarceration did not go unnoticed. A gifted and charming 35-year-old lawyer named Francis Scott Key was enlisted to try to help him. Receiving the consent of then-President James Madison, Key — who accompanied by prisoner exchange agent John S. Skinner — boarded a flag-of-truce ship and headed down the Chesapeake Bay towards the British.
Key and Skinner found the British officers still highly indignant. Prepared for this much, the Americans then produced letters from British soldiers who had been wounded during the recent Battle of Bladensburg; these letters expressed much gratitude for the kind and effective treatment they had received from American doctors.
This heartfelt literature had such a profound effect on the British that they decided to free Dr. Beanes. Upon his release, the doctor went with Key and Skinner to the truce ship, where — due to the outbreak of the Battle of Baltimore and the Royal Navy’s attack on Fort McHenry — they were forced to wait, and witness. A chorus of booming cannons and exploding rockets riveted them throughout the night.
When morning arrived, and Key saw that the American flag still flew above Fort McHenry, he was so moved that he took to verse, composing the poem, “Defence of Fort M’Henry,” which later became “The Star-Spangled Banner.” Interestingly, he made no effort to promote this composition. In fact, he did not even sign it. He merely showed his lyrics to a few friends, who then circulated the work. For several decades, Key’s name rarely appeared alongside these lyrics, which — by the time of the Civil War — had become arguably America’s most beloved song.
It wasn’t until 1931 that a congressional resolution signed by President Herbert Hoover made “The Star-Spangled Banner” the U.S. national anthem — an anthem that never would’ve existed had a lawyer not been asked to help out a doctor.
More Must-Reads from TIME
- Donald Trump Is TIME's 2024 Person of the Year
- Why We Chose Trump as Person of the Year
- Is Intermittent Fasting Good or Bad for You?
- The 100 Must-Read Books of 2024
- The 20 Best Christmas TV Episodes
- Column: If Optimism Feels Ridiculous Now, Try Hope
- The Future of Climate Action Is Trade Policy
- Merle Bombardieri Is Helping People Make the Baby Decision
Contact us at letters@time.com