President Trump’s decision to pick a racially charged fight with the world of pro football — one of a dwindling number of institutions that unite Americans of all races, classes and religions — carries a lot more political risk than past Twitter wars with the media and Hollywood figures his supporters detest.

Some NFL players are wealthy, but they aren’t the “elites” Trump likes to disparage. Nearly all the players kneeling for the national anthem to protest police brutality and racism are African American. It’s not only the black community that will wonder about Trump’s agenda after his comments this weekend — the league’s fans, who come from all racial backgrounds, may wonder as well.

At first glance, Trump’s armchair football battle played out the same way many of his Twitter and campaign-rally pronouncements have this year. The most conservative corners of Trump’s base cheered when he said he’d like to see NFL owners deal with a player who kneels for the national anthem by declaring, “Get that son of a bitch off the field right now. Out! He’s fired.” Many players in the NFL, which is roughly 70 percent African American, reacted in anger and joined in a protest that for the last year-plus had been conducted by only a handful of athletes.

But the great unknown in this fight is how the vast swath of Americans who are NFL fans will react to having their typically apolitical Sundays interrupted by politics on this scale. Will they side with the president or the players?

The answer depends, in part, on the devotion and economic power of Trump’s base. He encouraged his Twitter followers Sunday to boycott the NFL if players don’t “stop disrespecting our Flag & Country.”

Fox News commentator Sean Hannity, one of the most loyal Trump supporters, tweeted that “If @NFL and players choose to continue to make political statements (their right) I predict fans who disagree will flee (their right also).”

However, the odds favor most fans supporting the players. While Trump and his supporters point out that the NFL’s TV ratings started dropping last year, a J.D. Power survey in July of 9,200 fans found that 27 percent said they had watched more football in 2016 than the previous season and only 12 percent said they had watched less. The rest said they had watched the same number of games.

And in the bigger picture, some analysts said the optics of Trump taking on mainly African American athletes could hurt him among independent voters, who can make the difference in an election or help sway Congress on issues such as health care and tax reform.

“All of this racial stuff — from what he said after Charlottesville (Va.) to this — makes it harder for him to hold onto those voters,” said Gary Segura, dean at the UCLA Luskin School of Public Affairs and the Latino community pollster for Hillary Clinton’s presidential campaign last year.

“When you tell somebody they can’t speak their political mind, it cuts pretty hard in suburban, middle-class, white communities — even if they disagree with players taking a knee,” Segura said.

Trump, however, insisted Sunday that “this has nothing to do with race.” He told reporters, “I’ve never said anything about race. This has to do with respect for our country and respect for our flag.”

Winning over people who care about public displays of patriotism, however, is not Trump’s problem.

“It was an absolutely needless thing to do,” said G. Terry Madonna, director of the Center for Politics and Public Affairs at Franklin & Marshall College in Pennsylvania and a pollster in that state. NFL fans “cut across all demographic lines. They cut across all race and income levels. Sure, part of his base will like it, but it won’t do the president much good.”

NFL franchises in swing states that Trump won last year took part in blowback against Trump’s remarks. All but one member of the Pittsburgh Steelers declined to come out of the locker room for the national anthem, and the team’s owners backed them. Mark Murphy, CEO of the Green Bay Packers, called Trump’s comments “divisive” and “offensive.”

“The Packers are next to God here,” said Charles Franklin, director of the Marquette University Law School Poll in Milwaukee and one of Wisconsin’s top pollsters.

Franklin said Trump might be putting fans in an uncomfortable position if they don’t agree with the president’s boycott suggestion.If Wisconsin fans are forced to choose between their Packers and their president, Franklin said, “under any normal circumstances, the Packers always win that choice.”

Trump created the controversy after registering a small uptick in his historically low poll numbers. His approval rating — now 41 percent, according to the latest Real Clear Politics synthesis of top surveys — started to improve with the federal government’s response to recent hurricanes in Florida and Texas, and after Trump cut deals with congressional Democratic leaders to raise the federal debt ceiling.

“This (attack on protesting NFL players) is Trump coming back to the more divisive issues that have hurt him in the past,” Franklin said. “This is a move away from the things that were helping him.”

If Trump is interested in solidifying his base, he is succeeding. America First Policies, a group that is supportive of Trump, produced a digital ad Sunday titled, “Turn off the NFL,” that featured a photo of Trump with his hand over his heart and the hashtag #TakeAStandNotAKnee. And fans in some stadiums reportedly booed when players took a knee.

Speaking on ABC News’ “This Week With George Stephanopoulos,” Treasury Secretary Steven Mnuchin framed the case in classic culture-war terms.

“This is about respect for the military, the first responders,” Mnuchin said. “The players have the right to have their First Amendment off the field. This is a job.”

Asked about Trump’s “son of a bitch” reference, Mnuchin said, “I think the president can use whatever language he wants to use.”

But the president’s language risked creating division in other ways, said Robert Smith, a professor of political science at San Francisco State University and author of “Polarization and the Presidency: From FDR to Barack Obama.” He pointed to Trump’s statement to a largely white audience at a campaign rally in Alabama on Friday that NFL players who don’t stand for the national anthem show “total disrespect of our heritage, a total disrespect of everything that we stand for.”

“The ‘our’ appeals to the people who see this country as a ‘white country’ and it is being transformed,” Smith said. “He played on that during the campaign and got a lot of support. That’s just a part of his mantra now.”

Joe Garofoli is The San Francisco Chronicle’s senior political writer. Email: jgarofoli@sfchronicle.com Twitter: @joegarofoli