The crowds have thinned and the smoke has cleared, with more than a week of nationwide protests leaving in their wake a nation increasingly resolved to change a broken law enforcement system.

But they also have left police officers badly shaken, and in some cases physically bruised. Nationwide, police leaders say the rank and file are struggling to come to grips with the level of animus they encountered on the streets, as epithets, bricks and bottles all came hurtling their way.

Police have been targets of protest many times before, of course. But never quite like this.

“I’ve had members say they feel like a Vietnam veteran returning home to a country that hates them,” said Robert Harris, a Los Angeles police officer and director of the force’s police union. “It’s not that our members expect thank-yous. It’s the difficulty in knowing that the protesters want to be treated with equality and fairness and respect, and what they’re protesting for isn’t afforded to the officers themselves.”

“The morale is low,” he said. “They’ve taken quite a beating.”

Such sentiments are likely to elicit little sympathy from protesters outraged about the killing of George Floyd in police custody in Minneapolis, and the countless deaths of black Americans at the hands of law enforcement officers that preceded it. Police in the United States have shot and killed nearly 500 people already this year — an average of about three a day. The figure does not include those, like Floyd, who died by other means.

But the fact that police feel besieged and beleaguered potentially complicates efforts to transform Floyd’s death into a catalyst for changing the system and preventing the sort of brutality that protesters say his death exemplified.

Although many police leaders say they agree with protesters’ aims, they also think their efforts to change have been underappreciated and their line of work unfairly vilified.

“Law enforcement is the only profession where you get rocks, bricks and molotov cocktails thrown at you merely because you’re in the same chosen profession as someone else who did something horribly wrong thousands of miles away,” said Steven Casstevens, head of the International Association of Chiefs of Police. “I can’t believe that’s where we are. Aren’t we better than that as a country?”

President Trump has sought to channel that sense of grievance, staunchly defending law enforcement officers amid calls by some protesters and congressional Democrats to slash police funding. At a roundtable with police officials Monday at the White House, Trump called the nation’s police officers “great, great people” and signaled he would resist calls for wholesale change.

“There won’t be defunding,” Trump said. “There won’t be dismantling of our police. There’s not going to be any disbanding of our police.”

House Democrats introduced legislation this week that would transform many aspects of policing, including a ban on chokeholds and making it easier to prosecute police misconduct.

A Washington Post-Schar School poll released Monday found that a wide majority of Americans support the protesters, with nearly three-quarters of the country backing them. More than two-thirds of respondents said they thought Floyd’s killing reflected broader problems with police treatment of black Americans, up from less than half after 2014 protests in Ferguson, Mo.

Whether police agree remains to be seen. To at least some, the officers are the real victims.

“Stop treating us like animals and thugs and start treating us with some respect,” New York police union leader Mike O’Meara demanded angrily at a news conference Tuesday. “We’ve been left out of the conversation. We’ve been vilified. It’s disgusting.”

The rift between police departments and critics who urge their overhaul has grown in recent days as officers in several cities close ranks to defend colleagues accused of using excessive force on protesters.

In Buffalo, officers cheered two colleagues who shoved an elderly man to the ground during a protest, leaving him bleeding on the pavement. The police union in Philadelphia is selling “Bologna Strong” T-shirts, celebrating officer Joseph Bologna, who faces assault charges alleging he clubbed a student protester in the head.

David Klinger, a former officer who is now a criminologist at the University of Missouri at St. Louis, said many officers are experiencing “bewilderment” at the wave of anger they’re facing.

Klinger called Floyd’s killing “the most disturbing thing I’ve ever seen,” and he noted that police leaders nationwide have widely condemned it. But many officers feel as though they are being blamed for the crimes of others.

“They don’t understand the vitriol directed at them because they didn’t do anything. They are a symbol of something,” Klinger said. “Officers understand the righteous anger. But not why it is directed at them personally, and why it takes the form of rocks and bottles and bricks.”

The vast majority of participants in protests that filled cities from coast to coast did not use violence, police acknowledge. But some did, particularly in the days immediately after Floyd’s death on May 25, before widespread appeals for calm were heeded.

“Demonstrations that were peaceful during the day would change, and officers had to put themselves in position to prevent property damage. And that would result in violence toward property and toward them,” said Chuck Wexler, executive director of the Police Executive Research Forum, a D.C. policy center.

During two weeks spanning the end of May and the beginning of June, 749 officers were injured while responding to protests and disturbances, according to a Justice Department tally. That figure includes about 150 officers hurt in Washington, D.C., 22 of whom required hospitalization.

Two officers in Northern California were killed, although the exact motive and circumstances remain unclear.

The attacks add to a preexisting sense among many officers that they are under siege. But data shows there has been no sustained rise in the number of officers killed or assaulted in the line of duty during the past decade.

“To the extent that officers feel their lives are increasingly in danger, it’s probably not an accurate perception,” said Jeffrey Fagan, a criminologist at Columbia University.

Nor, Fagan said, did demonstrators’ aggression toward police appear to justify many of the violent acts carried out by officers during the protests, many of which were captured on videos that circulated widely on the Internet. Fagan said he saw multiple video clips in which police appeared to escalate confrontations when they could have done the opposite.

“I don’t know how they’re trained, but they should have been trained to withdraw if at all possible,” said Fagan, citing in particular a widely shared clip of New York officers using their vehicles to ram demonstrators amid a hail of thrown objects.

But within police departments, there often is a very different view, even among those sympathetic to calls for reform and the need to curb excessive force. In interviews, police commanders and union officials said that although there were undoubtedly instances in which officers overreacted, many showed remarkable restraint.

“What the cameras don’t capture is those officers are standing on those lines for 12-, 14-hour shifts and during that time they’re subject to verbal assault, rocks, bricks, frozen water bottles, human waste,” said Harris, the Los Angeles police union leader. “It takes a mental toll and a physical toll.”

Harris said dozens of officers in the department were injured, including one who was hit by a ricocheted bullet and at least two others who required surgery after being struck by heavy objects.

The violence by demonstrators, Harris said, was “disheartening,” particularly given the progress he thought Los Angeles police have made in addressing allegations of brutality. Last year, the union backed one of the nation’s most substantive police reform bills, one that narrowed the conditions under which officers can use deadly force.

“There’s a reason why we talk about not wanting other officers to tarnish our badge,” Harris said. “We want that thing to shine.”

Activists say police departments are still too resistant to calls for change, and too protective of bad actors. The California bill, they argue, was watered down in the face of police resistance — just one more example of officers standing in the way of much-needed change.

“This isn’t a lack of appreciation for officers who do a good job. It’s about holding people accountable for their actions,” said Jennvine Wong, a lawyer with the Legal Aid Society’s police accountability project in New York, where a Brooklyn prosecutor filed charges Tuesday against an officer who shoved a female protester to the ground on May 29.

“Some of the strongest rhetoric for holding accountable civilians who commit crimes comes from police departments,” Wong said. “But when it comes to officers committing crimes, they try to wiggle their way out of it.”

Police departments also are facing the risk of diminishing public credibility, as cellphone videos belie their official statements playing down incidents involving force by officers — such as when Buffalo police initially claimed that Martin Gugino, 75, “tripped and fell” during a protest.

In Los Angeles, Assistant Police Chief Robert Arcos said his department was reviewing dozens of reports of alleged excessive force by officers during the protests. “We want to investigate. Everybody wants answers,” he said.

The department, he said, is also trying to work with community leaders on broader police reforms. But he said those conversations are coming at a time when many officers feel disheartened and hurt.

The LAPD, he said, already has made significant changes to its training, its protocols for use of force and its engagement with citizens. But when the protests began, the vitriol rained down anyway.

“The level of violence was the worst that I’ve seen in my 32 years,” said Arcos, who was on the streets as a young officer during the 1992 uprising that followed the assault on motorist Rodney King. He said the intensity of attacks on police has been greater this time.

The demand for change, he said, is greater now, too.

“I’ve never seen people rally around the issue in the way they have today. It’s very loud. It’s got a lot of momentum. I understand it. I respect it. I know it needs to happen,” Arcos said. “But officers will tell me, ‘Chief, we’re doing all these things. And it’s still not enough.’ ”

Shayna Jacobs in New York contributed to this report.