Veda Monday hugs a police officer during a ceremony for fallen Kansas City, Kan., Capt. Robert Melton, shot and killed this month in his patrol car. (Charlie Riedel/AP)

The attacks on police in Dallas and Baton Rouge that left eight officers dead earlier this month sent waves of fear through law enforcement agencies across the country, with departments ordering officers to double up on patrols as a safety measure.

These deaths contributed to a grim tally this year. Through last week, 32 officers were shot and killed in the line of duty, according to the National Law Enforcement Memorial Fund, a nonprofit group that tracks these deaths. More than half of the officers fatally shot died in ambushes, the group said in a report released Thursday.

On average, about 25 officers have been shot and killed by the midyear point over the last decade, FBI data show. And since 2005, the FBI figures show that about 20 percent of fatal shootings of police have been ambushes.

The new numbers, released with the attacks in Texas and Louisiana still fresh in the public’s mind, come at a time when overall line-of-duty deaths have fallen significantly. On average, fewer officers have been fatally shot in each of the past four decades, overall line-of-duty deaths have decreased over that span, and deadly assaults are on a steady decline.

Overall, the memorial fund said that 67 law enforcement officers died in the line of duty through last week, up from 62 over the same period last year. The new report shows that 21 of these deaths were not in “felonious incidents.” Instead, they stemmed from car crashes, job-related illnesses and, in one case, an officer who drowned.

This was the first time in three years that traffic-related incidents were not the leading cause of death for officers at the midyear point, the new report said. Traffic-related deaths have outpaced any other cause of death for law enforcement in 15 of the past 20 years, according to memorial fund data.

Even as statistics have shown that policing has gotten significantly safer, current and former officers, as well as their relatives and union officials, have expressed increasing concerns recently about the safety of those in law enforcement.

The deadly shooting in Baton Rouge last week left three officers dead, while five officers were slain earlier this month in Dallas. Authorities have said that the shootings in Baton Rouge and Dallas both involved lone attackers who specifically targeted law enforcement.

The shootings in those places, combined with the killings of two bailiffs in Michigan and the fatal shooting of a Kansas City, Kan., officer, contributed to a brutal stretch for law enforcement. In a 12-day span this month, 11 officers were fatally shot, more than a third of all officers shot and killed all year.

According to the memorial fund, the average number of officers fatally shot by the middle of the year fell to 26 in this decade from 63 such deaths in the 1970s. At this point last year, 18 officers had been shot and killed, down from 24 in 2014, according to the memorial fund. The number of officers killed by gunfire at the midyear point on the calendar peaked recently in 2011, when 40 officers were shot and killed in the first half of that year, the law enforcement memorial fund’s reports show.

Although the number of officers fatally shot in 2016 has spiked significantly in recent weeks, there were already grim indications earlier this year. Through the first three months of 2016, the number of officers shot and killed had more than doubled from the same point a year earlier.

The first officers killed in the line of duty this year were officers in Utah and Ohio, both shot and killed over the same weekend.

Others have died while performing seemingly routine police work, such as serving a warrant in South Carolina or an eviction notice in Colorado. And in other cases, officers were shot but survived. For example, a Philadelphia officer was shot multiple times by a gunman who opened fire and later said he pledged loyalty to the Islamic State.

A number of people in or associated with law enforcement have described feeling on edge in recent years amid protests over how police use deadly force. Some officers said they were taunted or followed while working, while others said they kept their guns on them at times they would otherwise not. Groups that demonstrated against police tactics have repeatedly denounced violent attacks on officers like those seen in Baton Rouge and Dallas, condemning the shootings and saying that those assaults had nothing to do with their protests. 

After the Dallas ambush, which erupted at a peaceful protest in that city, many large police departments ordered officers to patrol in pairs as a way to improve their security. Cathy L. Lanier, the police chief in Washington, said she ordered her officers to double up hours after the Dallas rampage. She acknowledged that it would not have necessarily made much of a difference for an attack like the one in Dallas, where a gunman opened fire at officers grouped together downtown, but she described it as a tactic that could bring peace of mind.

“Looking at the type of attack that happened in Dallas, a two-man car, a four-man car, a 10-man car, isn’t going to make much of a difference,” Lanier said. “But it makes the officers feel much safer.”

The New York Police Department announced this week that it would spend $7.5 million getting new protective gear for officers, so that thousands of ballistic helmets and vests could be given to patrol units.

“Now, more than ever, society is asking its police officers to go into harm’s way and to face grave danger,” William J. Bratton, the New York police commissioner, said in a statement. “The department is fortunate to have the financial support to ensure that as they do, they have the best equipment and protection available.”

Further reading:

America is safer than it was decades ago. But homicides are up again in Chicago and cities across the country

Nation’s officers were on edge as deaths in Dallas bring yearly toll among police to 25

In Baton Rouge, 10 minutes of terror leave three officers dead and three more wounded

From 2015: Officers described feeling more tension and concern