Hundreds of protesters gather outside Minnesota Gov. Tim Walz’s official residence, Friday, April 17

President Trump has put Democratic challenger Joseph R. Biden on the defensive in Minnesota, an unlikely battleground that hasn’t voted Republican in a presidential election since 1972.

It’s a rare opportunity for Mr. Trump to expand the electoral map and potentially capture Minnesota’s 10 electoral votes to offset a potential loss in Michigan or Wisconsin, two states that he narrowly won in 2016.

Mr. Trump came close to winning Minnesota four years ago. He lost the state to Hillary Clinton by a little more than 1.5 percentage points. This time, his law-and-order message has been amplified by months of unrest and riots in Minneapolisafter the death of George Floyd, a Black man, in police custody.

The president’s momentum prompted Mr. Biden’s team to spend millions of dollars on advertising in the state.

“President Trump has tapped into an organic enthusiasm from Minnesotans who are tired of career politicians’ lip service with no results, and we see an opportunity to win Minnesota with voters who want four more years of the president’s ‘America First’ agenda,” said Samantha Zager, a spokesperson for the Trump campaign.

The polling in Minnesota is mixed. Several polls show Mr. Biden with a solid lead, and the Real Clear Politics average of recent polls in the state puts Mr. Biden ahead by 5.8 percentage points.

A recent Emerson poll, however, shows the president outperforming his 2016 exit polls for men and women, and among younger voters and voters without a college degree.

He also racked up endorsements from six Democratic mayors in Minnesota.

Since the death of Floyd on Memorial Day, the state has been plagued by Black Lives Matter protests that sometimes devolve into riots at night. It took the National Guard to stop the torching and looting of businesses in Minneapolis, and the president repeatedly threatened to send in troops to halt the chaos.

The riots across the state resulted in roughly $500 million in damage and the deaths of at least two people.

The Trump campaign thinks the president’s law-and-order message is resonating in Minnesota because of the unrest.

But critics argue that Mr. Trump turned a blind eye to the protests against racial injustice that have energized Black voters and the Democratic base.

Democratic Party strategist Antjuan Seawright said the law-and-order message is made up of “coded words” to rally what he called Mr. Trump’s racist supporters.

“It is definitely going to tickle the hearts and minds and ears of the Republican base that supports Donald Trump,” Mr. Seawright said.

He predicted that the president’s messaging would backfire and he would lose Minnesota as well as Rust Belt states such as Michigan and Wisconsin that put him over the top in 2016.

“From the time Donald Trump has taken office, the mood and temperature of the country have changed,” Mr. Seawright said. “Things are shifting, and voters are starting to see through the smog.”

However, former Minnesota Sen. Amy Koch, a Republican in the Twin Cities metro region, said she is hearing from voters who are frustrated with the unrest and the doom and gloom rhetoric about COVID-19 from Democratic politicians.

Minnesota voters recognize what happened to Floyd was wrong, she said, but they do not approve of the violence and rioting.

She said first lady Melania Trump’s speech at the Republican National Convention, where she called for a peaceful change instead of violence and anger, was the right tone to win over Minnesota voters.

“It is that message that I think could really resonate here,” said Ms. Koch, the state’s first female Senate majority leader. “There is this need for some hope.”

In 2016, Mr. Trump was hurt at the polls in Minnesota by anti-Trump Republicans such as Ms. Koch. Many voted for Evan McMullin, who led a “Never Trump” movement and garnered about 1.8% of the vote, which was more than Mrs. Clinton’s margin of victory.

Where those votes go this year remains to be seen.

Mr. Trump barely campaigned in Minnesota in 2016. He made his only appearance on the Sunday before the election.

This time, Mr. Trump is lavishing money and attention on Minnesotans and last month visited the Twin Cities and Mankato. His family members also have been campaigning in the state, as has Vice President Mike Pence, who recently visited Duluth.

Mr. Biden and his running mate, Sen. Kamala D. Harris of California, also have jetted into the state.

During a cross-state tour this month, Ms. Harris said they would not take Minnesota voters for granted.

“We need to earn the vote of every Minnesotan, and we will do that based what clearly is our plan to be relevant to Minnesota families,” she said in an interview with KARE-TV in Minneapolis.

The president and Mr. Biden will both campaign in the state on Friday.

Mr. Trump will host an event in Bemidji. Mr. Biden, who would be making his first campaign visit to the state, promised to be there Friday but did not provide details.

Mr. Biden’s wife, Jill, has visited the state on his behalf.

Both campaigns have begun airing ads there this month and have reserved millions of dollars in airtime, according to reports. Mr. Trump is looking to spend $14 million on advertising in Minnesota ahead of Nov. 3, and Mr. Biden has reserved roughly one-third of that amount.

“If Democrats were not worried about losing their grip on Minnesota, then Bidenwouldn’t be visiting there and they wouldn’t be going up on air there. They’d be spending those resources in Georgia and Texas,” said Donald Trump Jr., a top surrogate for his father’s campaign. “All you have to do is look at how Biden and Democrats are treating Minnesota to know that this state is in play.”

If Mr. Trump wins the state, it will be the first time Minnesota has backed a Republican since the 49-state landslide of Richard Nixon in 1972. It voted twice against Ronald Reagan and was the only state to prefer Walter Mondale in Reagan’s 1984 victory.

Javier Morillo, a Democratic Party strategist in St. Paul, said his state is purple but most of the population is concentrated in urban areas, which leans heavily Democratic.

He predicted a victory for Mr. Biden because Mrs. Clinton was able to win the state in 2016 despite lower than expected Democratic turnout, which he said will not happen this November.

“This time around, it is a different ballgame. Democrats are very energized by four years of Donald Trump, so I think our turnout goals are going to be high and are going to be met,” he told The Washington Times.

A poll completed in August by the Trafalgar Group showed the president and Mr. Biden in a tie.

More recent polls by KSTP/SurveyUSA and Public Policy Polling showed Mr. Bidenwith a 9-point and 8-point lead, respectively. Both leads are larger than what polls gave Mrs. Clinton in September 2016.

Still, Trump fans see an opportunity for the president’s message to break through.

“It’s law and order,” said Republican Party strategist Corey Lewandowski, one of Mr. Trump’s 2016 campaign managers and co-author of the 2017 book “Let Trump Be Trump.”

He thinks the message to end violence and unrest is resonating across swing states such as Minnesota and in his home state of New Hampshire, where Mr. Trump lost to Mrs. Clinton in 2016 by less than 0.5 percentage points.

“He is going to win by a larger electoral margin than he did in 2016,” Mr. Lewandowski said. “Everybody deserves a safe environment to have a home in, to have a business in, to worship in, and have your kids go to school.”



• Seth McLaughlin contributed to this report.