San Francisco 49ers Eric Reid, left, and Colin Kaepernick kneel during the national anthem before a September 2016 game. Playing the national anthem before a sporting event begins is an old tradition, as is subverting it. (Marcio Jose Sanchez/Associated Press)

As far as history remembers, the “Star-Spangled Banner” was first sung at a professional ballgame 99 years before President Trump demanded that football players be fired for defying the tradition — which has always been a bit of a rowdy one, really.

The tradition began before the National Football League even existed, and long before a 19th-century war song became our national anthem.

It began in Chicago, in 1918, in the seventh inning of a particularly depressing Cubs game.

Two out of three seats at Comiskey Park would have been empty for the team’s first World Series faceoff with the Boston Red Sox, as the New York Times reported. And the 10,000 or so fans who showed up weren’t much in the mood for cheering, for “the mind of the baseball fan was on the war.”

Baseball, moreover, had a PR problem, as The Washington Post noted many years later. World War I had killed tens of thousands of American soldiers, far from the lush green grass on which those players played.

Also, as ESPN later noted, someone had bombed the Chicago Federal Building one day earlier.

Play ball.

“Although the Cubs festooned the park in as much red, white and blue as possible, the glum crowd in the stands for Game 1 remained nearly silent,” ESPN wrote.

Until the seventh-inning stretch, that is, when fans rose to stretch their legs and — for whatever reason — the military band struck up an old ditty about “bombs bursting in air” and so forth.

The Red Sox third baseman, a Navy man, “immediately faced the flag and snapped to attention with a military salute,” ESPN wrote. Other players did likewise, and in the bleachers, hands hit hearts as the crowd sang along and finally exploded in applause — “far different from any incident that ever occurred in the history of baseball,” the Times reported.

The tradition quickly spread across the league, and it had made its way into other sports by the time “The Star-Spangled Banner” was adopted as the official national anthem in 1931.

“The playing of the national anthem should be as much a part of every game as the kickoff,” NFL Commissioner Elmer Layden told the Times at the conclusion of World War II, as he invited President Harry Truman to attend a Washington Redskins game.

“We must not drop it simply because the war is over,” Layden said. “We should never forget what it stands for.”

The country took the commissioner’s advice, more or less. But exactly what the anthem stands for has been the subject of much dispute on many a playing field.

Early on, some attempted to uncouple the anthem from the game.

Repeating the spectacle too often “tends to cheapen the song and lessen the thrill of response,” Baltimore Orioles general manager Arthur Ehlers said in 1954, when he decided to stop playing it before each game, according to Marc Ferris’s book, “Star-Spangled Banner.”

“Within a month, Ehlers relented,” Ferris wrote.

Likewise, the Chicago White Sox attempted to swap out the notoriously hard-to-sing anthem out for the more crowd-friendly “God Bless America” in the 1960s — but incurred the wrath of what Ferris described as “militant patriots” who thought the substitution insulted troops fighting in the Vietnam War.

And woe to the celebrity who botched the sacred singing in decades to come, as Roseanne Barr discovered in 1990, and poor Christina Aguilera in the 21st century.

As the tradition solidified on ballparks and football fields across the country, even slight variations in the anthem’s rendition “became tantamount to an act of treason,” the Washington Star once wrote, according to Ferris.

But Trump doesn’t seem to be a stickler in that regard. He tweeted his delight in 2013, when, after the Boston Marathon bombing, the Bruins’ professional anthem singer stopped mid-lyric before a hockey game and let the crowd finish the song, which it rendered with gusto, including whistles and cheers.

Rather, Trump is upset by the latest incarnation of something that has become as much a sporting tradition as the anthem itself: its subversion by athletes with a point to make.

“The Star-Spangled Banner achieved even greater significance in the 1970s, when pregame ceremonies grew from quaint, utilitarian rituals into spectacles,” Ferris wrote. Like the song itself, these displays were often militaristic, as we were recently reminded when the Pentagon was revealed to be paying for patriotic displays at professional games.

Back at the tail end of the civil rights movement, all this anthem pageantry began to rankle some athletes, who thought it glossed over racial injustices in U.S. society.

The most infamous protest took place not on an American playing field, but at the 1968 Summer Olympics in Mexico City, at an awards ceremony attended by two black American sprinters: Tommie Smith and John Carlos. As the anthem began to play, both men turned their backs on the flag and raised gloved fists as the crowd booed and screamed the lyrics — until, Carlos later wrote, “it seemed less a national anthem than a barbaric call to arms.”

Both sprinters were ordered to leave the stadium and then suspended from the team — but subsequently became immortal for their dissenting silence in the face of our national song.

Seeking to avert a repeat of the Olympics protest on his football fields, Ferris wrote in his book, NFL Commissioner Pete Rozelle ordered the same year that players “hold their helmets in their left hands and salute the flag during the anthem.”

Inevitably, that command inspired defiance. David Meggyesy, a linebacker for the St. Louis Cardinals and known opponent of the Vietnam War, bowed his head instead when the song struck up and did not salute.

A lonely protester at the time, Meggyesy was benched the next year and left football.

But the old linebacker exclaimed “thank you, thank you, thank you” half a century later, after the San Francisco 49ers quarterback took a knee during the anthem and inspired many to do the same — an American tradition of ballgames, anthems and dissent, which not even the president has been able to stop.

Read more:

Players, owners unite as Trump demands NFL ‘fire or suspend’ players or risk fan boycott

Shahid Khan, the Jaguars owner who stood with his team, has long espoused the American Dream

Colin Kaepernick protest has 49ers fans burning their jerseys

A brief history of ‘The Star-Spangled Banner’ being played at games and getting no respect