It was on the rainy night of 13 September, 1814, that a 35-year-old US lawyer named Frances Scott Key watched as a barrage of British shells rain down on Fort McHenry in Baltimore Harbour. The War of 1812 had been raging for more than 18 months and Key was negotiating the release of an American prisoner. Fearful he knew too much, the Brits kept him on board a ship eight miles from shore. As night fell, he saw the sky turn red, and given the scale of the attack, was convinced the British would triumph. “It seemed as though mother earth had opened and was vomiting shot and shell in a sheet of fire and brimstone,” he observed. But as the smoke cleared in “the dawn's early light” on 14 September, Key watched in astonishment and relief as the US flag, not the Union Jack, was raised over the fort.

According to the Smithsonian Institution, which boasts among its many historical treasures that original star-spangled banner, Key was so overcome by what he had witnessed that he was inspired to poetry. He showed the verses to his brother-in-law, Joseph H Nicholson, commander of a militia at Fort McHenry, who pointed out that the words would fit perfectly to the tune of a popular English ditty written in 1775 by the composer John Stafford Smith. The Anacreontic Song or Anacreon in Heaven had been penned for Smith’s aristocratic gentlemen’s club in London, but by the early 19th Century had travelled across the Atlantic and become well-known in the US.

Impressed by Key’s efforts, Nicholson took the poem to a printer in Baltimore and had it distributed it under the name Defence of Fort M'Henry, indicating the tune to which it should be sung. The Baltimore Patriot newspaper soon reprinted it, and within weeks, The Star-Spangled Banner, as it was quickly known, appeared in print across the country, immortalising both Key’s words and the soon-to-be historic flag it celebrated.

‘Soul-stirring words’

Adopted by the navy in 1889, the song was quoted in 1904 by Puccini in his opera Madama Butterfly. (The first two bars are a direct lift, giving the character Lieutenant Pinkerton his cue for the aria Dovunque al Mondo, while “O say, can you see…” is used in later arias by both Pinkerton and Cio-Cio San, Madama Butterfly herself.) In the early 20th Century, the song’s appeal seemed unstoppable. So popular had it become by 1916, in fact, that there were dozens of different versions, and President Woodrow Wilson asked the US Bureau of Education to produce an official edition. They in turn enlisted the help of five musicians: Walter Damrosch, Will Earheart, Arnold J Gantvoort, Oscar Sonneck and John Philip Sousa. The first performance of the standardised version was given at Carnegie Hall in December 1917. It was not, however, until 3 March, 1931, that The Star-Spangled Banner was officially made the United States’ national anthem by a congressional act signed by President Herbert Hoover.

It was not until 3 March, 1931, that The Star-Spangled Banner was officially made the United States’ national anthem

That relatively recent date may come as a surprise to those who imagine the anthem must go back much further in history, but this lack of awareness may be symptomatic of a wider trend. “Many Americans don’t realise how much of what we think is foundational in our country actually stems from the 1920s and the Depression era,” says Sarah Churchwell, professor of American literature and public understanding of the humanities at the University of East Anglia, and author of the widely acclaimed book Careless People. “When F Scott Fitzgerald – a distant relative of Frances Scott Key, after whom he was named – was beginning to think about The Great Gatsby in 1922, the year in which he would set the novel, America was still arguing about whether it should adopt a national anthem.” Although The Star-Spangled Banner was a frontrunner, Churchwell points out that it was vehemently opposed in certain quarters, especially among temperance campaigners. (John Philip Sousa had declared, perhaps literally: “it is the spirit of the music that inspires” as much as Key's “soul-stirring” words; it’s often quipped that you need to be drunk to sing it.)

American Dream

On 11 June, 1922, the Christian Scientist Augusta Emma Stetson, who had built the imposing First Christian Science church on New York’s Central Park West, took out a remarkable (and huge) advertisement in the New York Tribune with the headline “The Star-Spangled Banner Can Never Become Our National Anthem”. It talks of those “violent, un-singable cadences” which could never express “the spiritual ideals upon which the nation was based.” (“Not only had the music had not been composed by an American,” says Churchwell; “worse, it was ‘a ribald, sensual drinking song’.”) “Never,” thundered the advertisement, “has Congress, and never will Congress, legalize an anthem which sprang from the lowest qualities of human sentiment.” It warned, ominously: “God forbids it.”

Congress had other ideas. “The Star-Spangled Banner was made America’s national anthem in 1931, two years after the market crashed, when Americans needed a renewal of faith,” says Churchwell, who points out that this was also the year in which the phrase ‘American Dream’ became a national catchphrase, thanks to a book called The Epic of America by James Truslow Adams. The connection, she believes, is salient. “In general, I think Americans are encouraged to think that everything about our country stretches back into the mists of time, and transcends history. That’s a key aspect of the American Dream, and it’s exactly what Fitzgerald put his finger on in Gatsby, the idea that we are constantly pulled back into our own history without understanding it.”

Star-Spangled Banner: Greatest hits

  • Jimi Hendrix, live at Woodstock in 1969 going crazy on the electric guitar (on the Monday morning…!)
  • Marvin Gaye’s weirdly sensual take on it from 1983
  • Whitney Houston in 1991 – pre-recorded, but who cares: that voice!
  • Beyoncé just nailing it at the 2004 Super Bowl
  • Lady Antebellum in the 2010 World Series – with the Grammy award-winners giving a particularly nice line in close harmony…
  • And while we’re talking harmony, it may be cheesy as heck but – these guys! Maybe the most moving ever?

If you would like to comment on this story or anything else you have seen on BBC Culture, head over to our Facebook page or message us on Twitter.