The deadly police shooting of a Black man in Philadelphia has roiled the presidential campaign in a key battleground state just days before the election, igniting tensions over race, violence and law enforcement that pose political challenges for Joe Biden and President Trump.

Trump has seized on riots and looting that erupted in the aftermath of Monday’s shooting in an effort to portray Biden as soft on crime, while selling himself as the “law and order” candidate. “You can’t have chaos like that — and he’ll be very, very weak,” Trump predicted Wednesday of the Democratic nominee.

Biden has pushed back on those attacks, saying repeatedly that he does not condone looting and has no tolerance for violence against police. He also expressed outrage at the killing of Walter Wallace Jr., condemning in strong terms “another Black life in America lost.” Trump on Wednesday called the shooting a “terrible event” and said the federal government is looking into it. Philadelphia was under a curfew Wednesday night.

Philadelphia police officers fatally shot Walter Wallace Jr. on Oct. 26. Wallace had a knife and, according to his family, was suffering a mental health crisis. (The Washington Post)

Biden’s remarks highlight the fragile balance he is trying to strike as he aims to secure victory in Pennsylvania, an important state Trump won four years ago but where he now trails Biden narrowly, polls show.

To secure victory, Biden is counting on strong support from the populous suburbs around Philadelphia. Those areas have swung sharply Democratic since 2016, but Trump believes he can win back some of his supporters with his law-and-order message.

“We are the swingiest of states,” said the Rev. Mark Tyler, a Biden supporter who has been out in Philadelphia amid the protests this week and worries the looting will overshadow Wallace’s death. “A lot of people are really feeling afraid that the narrative that comes out is one that reinforces the one that Trump has used all along in the suburbs.”

But Biden also needs high turnout among African Americans and other supporters in the city, where voters tend to be more liberal. And the former vice president’s emphasis on violent protesters has frustrated some, who say he should focus less on looting and more on racial justice.

“I think it could have been stronger,” said Helen Gym, a Democratic at-large member of the Philadelphia City Council, of Biden’s response.

The Rev. Al Sharpton, a close Biden ally, found a silver lining in what some saw as timidity on Biden’s part: “Even if he did not say all that we wanted, he was a hundred percent better than President Trump.”

Public polls taken after turmoil this summer but before the events in Philadelphia found swing-state voters trusting Biden more than Trump to deal with racism and, more narrowly, with maintaining “law and order,” showing the risks he assumed by leaning into the situation in Philadelphia.

Trump has frequently fanned racial divisions and, in June, authorities fired flash-bang shells, gas and rubber bullets into a crowd of peaceful protesters near the White House so the president could stage a photo op in front of a church.

The killing of George Floyd by a Minneapolis police officer sparked weeks of national protests this summer against systemic racism and police brutality. Biden has navigated this reckoning carefully, vowing to take on racism and embracing some law enforcement reforms.

But he has rejected calls on his party’s left wing to “defund the police,” a polarizing view Trump has eagerly run against. Biden has said he believes most police officers are good, as he seeks to fend off accusations that he is hostile to law enforcement.

On Wednesday, Biden once again tried to strike that balance. Asked by a reporter what he would say to residents outraged by the killing, he quickly brought up looting.

“There is no excuse whatsoever for the looting and the violence. None whatsoever,” said Biden, speaking after casting his ballot in Delaware. He cited Wallace’s father’s pleas to stop destroying the city.

Biden also said the county must “deal with how you diminish the prospect of lethal shooting in circumstances like the one we saw,” and said he would establish a commission to tackle that topic.

At a campaign stop Wednesday, Sen. Kamala D. Harris (D-Calif.) told reporters that Biden’s proposal would bring renewed attention to the issue of police brutality. “It’s not another commission,” she said.

“Part of the reason that people are marching in the streets is that there has not been the level of attention, especially recently over the last few years, that is necessary from the president of the United States. And Joe’s committed to that,” she added.

Wallace, 27, was killed on a Philadelphia street Monday afternoon in an incident recorded on video. He was armed with a knife when he was shot and was advancing toward two officers who told him to drop the weapon. His mother witnessed the shooting, and his family said he suffered from mental illness and has questioned why lethal force was used.

Authorities have released few details about the shooting. City officials have launched an investigation.

Wallace’s death was followed by two nights of crowded demonstrations, most of which were peaceful. But police commissioner Danielle Outlaw said there were nearly 300 reported incidents of looting and 81 arrests made on Tuesday night, most for burglary. Thirty police officers were injured and 91 people were arrested overnight Monday amid looting and arson.

On Tuesday, Biden issued a written statement expressing “shock and grief” at Wallace’s killing and said his was a “black life that mattered.”

But that statement also urged the protesters to practice restraint.

“No amount of anger at the very real injustices in our society excuses violence. Attacking police officers and vandalizing small businesses, which are already struggling during a pandemic, does not bend the moral arc of the universe closer to justice,” said the statement, which he issued jointly with Harris.

Officials took further steps to restore order to the city Wednesday. The state National Guard was authorized to intervene, and city officials enforced a 9 p.m. curfew. The city faced similar protests earlier this year in the wake of the killing of George Floyd.

Trump has aggressively sought to tether Biden to the situation on the ground. “Last night Philadelphia was torn up by Biden-supporting radicals,” Trump said Tuesday in Wisconsin, without presenting evidence.

Beyond Pennsylvania, some conservatives were eager to raise the issue. During a Wednesday swing through Iowa, where he campaigned with local Republican candidates, Sen. Tom Cotton (R-Ark.), a potential 2024 presidential hopeful, invoked the unrest in Philadelphia to argue that Democrats would not crack down on looting or rioting.

“You had a violent criminal wielding a knife, and police officers who defended themselves and innocent lives, and now dozens of police officers had been injured, stores have been looted,” Cotton told an audience in suburban Des Moines. “Imagine what would happen if Joe Biden and the Democrats are in charge of the Department of Justice,” he added, suggesting that Biden would go after law enforcement.

David Weigel in Urbandale, Iowa, and Mark Berman in Washington contributed to this report.