The number of police killed in the line of duty rose sharply in 2016, driven by shootings of police around the country, most notably ambushes in Dallas and Baton Rouge, Louisiana.

From Jan. 1 through Wednesday, 135 officers lost their lives. Some died in traffic accidents, but nearly half were shot to death.

That's a 56 percent increase in shooting deaths over the previous year. Of the 64 who were fatally shot, 21 were killed in ambush attacks often fueled by anger over police use of force involving minorities.

"We've never seen a year in my memory when we've had an increase of this magnitude in officer shooting deaths," said Craig Floyd, president and chief executive of the National Law Enforcement Officers Memorial Fund. "These officers were killed simply because of the uniform they wear and the job they do. This is unacceptable to the humane society that we are."

In Dallas, a sniper on July 7 attacked at the end of what had been a peaceful rally against police brutality. He killed five law enforcement officers and wounded nine others — the largest death toll among law enforcement from a single event since the 9/11 attacks, which killed 72 officers. Months later, Dallas businesses and residents still display blue ribbons and banners declaring, "We support our Dallas police officers."

But even amid community support, the police department remains unsettled. Hundreds of officers have retired or left the force over the past six months as the city struggles to find a way to increase pay and save a failing police and fire pension. Former Chief David Brown, who became a national figure in the aftermath, was among those who opted to retire. And interim Dallas Police Association president Frederick Frazier said that morale is "almost nonexistent."

"A lot of us are going through the motions at work. We're hoping things will get better with our struggle," he said. Frazier added that the attack was a "game changer. It changed the perception of law enforcement. It reversed the roll after Ferguson. We were the pursuer and now, we're being pursued."

Story continues

Less than two weeks after the Dallas attack, a lone gunman in Baton Rouge shot and killed three officers and wounded three others outside a convenience store in the weeks after a black man, 37-year-old Alton Sterling, was shot and killed by police during a struggle.

Baton Rouge Police Cpl. Lester Mitchell was partners with Matthew Gerald, one of the three slain officers, and was among the officers who raced to the scene of the shooting that also killed sheriff's deputy Brad Garafola and officer Montrell Jackson. Mitchell has daily reminders of the deadly shootout, driving past the scene on his way to police headquarters.

"Just passing there, you can't help but replay it over and over again," he said.

Mitchell said the shooting has made him more alert and aware of potential dangers on patrol, sometimes in situations that wouldn't have alarmed him before, like a hand in a pocket. "You learn to cope with it, because if you don't, you can drive yourself crazy," he said.

The National Law Enforcement Officers Memorial Fund's Floyd said the impact of this year has been profound on law enforcement. Agencies are struggling to recruit officers to their ranks and those who continue to serve "talk about how their head is now on a swivel."

"They're always looking over their shoulder, always worrying about the next attack that could come at any time from any direction," Floyd said.

That was underscored by the slaying in November of a San Antonio detective who was fatally shot and killed outside police headquarters as he was writing a traffic ticket. The man accused of shooting him said he was angry about a child-custody battle and simply "lashed out at somebody who didn't deserve it."

___

Associated Press reporters Claudia Lauer in Dallas and Mike Kunzelman in Baton Rouge contributed to this report. Pane reported from Atlanta. She can be followed on Twitter at: http://twitter.com/lisamariepane .