The instantly-recognizable song is played before thousands of sporting events every year, but just how did the Star-Spangled Banner come to be a staple of sports in the first place? The answer, it turns out, has to do with World War I.

Baseball fans in the late 19th century might’ve heard live military bands play the Star-Spangled Banner at a game every so often, but the song—which hadn’t yet been designated as the national anthem—wasn’t really a common occurrence at sporting events. That began to change on September 5, 1918, during  Game 1 of the World Series between the Boston Red Sox and the Chicago Cubs. It was an era when the Red Sox still had Babe Ruth, and the phrase “the last time the Cubs won the World Series” wasn’t yet a joke. In fact, the two teams had won six of the last 15 world championship titles.

Yet even though the event featured two teams at the top of their games, the crowd was somber that day, writes ESPN The Magazine. Since entering the Great War a year and a half ago, more than 100,000 U.S. soldiers had died. And just a day before the game, a bomb had exploded in Chicago, (the city in which the game was held), killing four people and injuring dozens more. In addition, the U.S. government had recently announced that it would begin drafting major league baseball players.

All this sat heavy on the shoulders of both the players and the smaller-than-usual crowd of fans that day. But during the seventh-inning stretch, the U.S. Navy band began to play the Star-Spangled Banner; and something changed.

A giant flag lowered for the national anthem during the Red Sox home opener at Fenway Park in Boston, 2015. (Credit: Jessica Rinaldi/The Boston Globe via Getty Images)
Jessica Rinaldi/The Boston Globe via Getty Images
A giant flag lowered for the national anthem during the Red Sox home opener at Fenway Park in Boston, 2015.

As the song began, Red Sox infielder Fred Thomas—who was in the Navy and had been granted furlough to play in the World Series—immediately turned toward the American flag and gave it a military salute, according to the Chicago Tribune. Other players turned to the flag with hands over hearts, and the already-standing crowd began to sing. At the song’s conclusion, the previously quiet fans erupted in thunderous applause. At the time, the New York Times reported that it “marked the highest point of the day’s enthusiasm.” The song would be played at each of the Series’ remaining games, to increasingly rapturous response. And patriotism played a part right from the start, as the Red Sox gave free tickets to wounded veterans and honored them during the playing of the Star-Spangled Banner before the start of the decisive Game 6.

The New York Yankees hold their caps over their hearts during a performance of the national anthem, 1921. (Credit: FPG/Getty Images)
FPG/Getty Images
The New York Yankees hold their caps over their hearts during a performance of the national anthem, 1921.

Other baseball parks began to play the song on holidays and special occasions, and Red Sox owner Harry Frazee made it a regular part of Boston home games. The Star-Spangled Banner officially became the U.S. national anthem in 1931, and by the end of World War II,  NFL Commissioner Elmer Layden ordered that it be played at every football game. The tradition quickly spread to other sports, aided by the introduction of large sound systems and post-war patriotism.

The anthem’s adoption also gave way to a new American pastime, almost as beloved as sports itself: complaining about people’s behavior during the national anthem. By 1954, Baltimore Orioles general manager Arthur Ehlers was already bemoaning fans he thought disrespected the anthem by talking and laughing during the song. Ehlers briefly stopped playing the anthem altogether, before relenting to pressure and reinstating it a month later.