Most Americans are familiar with the story of how our national anthem, “The Star-Spangled Banner,” came to be. Francis Scott Key, a 35-year-old lawyer and budding poet from Washington, D.C., was in Baltimore in September 1814, when the British bombarded Fort McHenry. He successfully negotiated the release of an American prisoner there, but the British insisted that he stay on the truce ship President during the battle, from September 13-14. Just miles from Fort McHenry, Key watched what he would later describe as the “rocket’s red glare” and the “bombs bursting in air”—and come morning, the hoisting of an American flag at the fort in victory.

Inspired by what he witnessed, Key wrote an impassioned four-stanza poem, or song. Over a century later, on March 3, 1931, President Herbert Hoover signed a bill into law that made Key’s patriotic song the official anthem of the United States.

The Maryland Historical Society counts among its most prized artifacts the original manuscript of “The Star-Spangled Banner.” The document is on display in the society’s new exhibition “In Full Glory Reflected: Maryland During the War of 1812.”

But how much do you know about Key’s musical influences? And about how the song was popularized?

David Hildebrand, director of the Colonial Music Institute, is an expert in early American music and has studied “The Star-Spangled Banner” in great depth, putting it into the musical context of its times. The following close analysis of the structure and lyrics of Key’s song is based on a conversation with the music historian.