Updated

Hours after five Dallas police officers were killed by sniper fire during a July protest over police aggression, a call reporting a break-in at an apartment came in to the Valdosta Police Department in Georgia.

Officer Randall Hancock, a 10-year veteran, responded to the scene, where an armed man later identified as Stephen Beck was lying in wait. Beck shot Hancock three times, with two bullets catching in his bulletproof vest and a third entered his abdomen. Hancock, who survived, returned fire and severely wounded the suspect.

Beck, 22, was suffering from depression and set up the scene in a bid to commit suicide-by-cop.

It was just one example in a growing number of police officer ambushes across the country in recent months. On Wednesday night, two Boston police officers were critically injured after responding to a domestic call where they were shot by a man wearing body armor. And on Saturday, two Palm Springs, Calif., police officers were killed by a suspected gang member who lured them to their deaths.

Law enforcement experts say an ambush assault consists of four factors: the element of surprise, concealment of the assailant, suddenness of the attack and a lack of provocation. They can be planned or spontaneous.

“It can happen anywhere, anytime,” Kevin Hassett, the president of the Retired Police Association of the State of New York, said. “You keep your fingers crossed and hope you go home at night and see your kids.”

Hassett worked for the Port Authority of New York and New Jersey Police Department for 30 years. Although he saw violence and chaos in his time, he believes an anti-cop climate that some say is fueled in part by Black Lives Matter, has made the job even more dangerous.

“Wearing the uniform always came with an inherent risk, even back then,” he said. "I'm just glad I'm not a cop now."

The past year has taken its toll on many police departments and communities across the country. Racially charged police shootings have driven a wedge between police and the vulnerable communities they protect.

Some police say politicians have abandoned them to score political points and say they face a greater threat of targeting than ever.

In the Dallas incident that came just before Hancock was shot, five officers were gunned down from afar as they tried to secure a protest over the police shootings of black men in Minnesota and Louisiana. Sniper Micah Xavier Johnson, 25, who was eventually blown up by a Dallas police robot during a standoff with police, said he “wanted to kill white people.”

3d36edb5-de

President Obama shakes hands with Dallas police chief David Brown during a memorial service following the multiple police shootings in Dallas (Reuters)

Later that same month, three police officers in Baton Rouge were killed during a shooting rampage. One of the officers, Montrell Jackson, a 10-year veteran who left behind a 4-month-old boy, had days earlier taken to Facebook to talk about life as a police officer under the recent stress.

“I swear to God I love this city but I wonder if this city loves me. In uniform I get nasty hateful looks and out of uniform some consider me a threat. I’ve experienced so much in my short life and these last 3 days have tested me to the core,” the post read.

fe

Montrell Jackson, 32, was one of three police officers killed in a shooting incident July 17. (Reuters)

Steven Groeninger, the communications director for the National Law Enforcement Officers Memorial Fund, said there have been 14 deadly ambushes involving police officers compared to 16 all of last year. Since 2000, there have been roughly 200 ambush attacks on police officers each year.

Carla Barrett, an assistant professor at John Jay College of Criminal Justice, did not study recent statistics regarding police ambushes, but spoke to FoxNews.com about the issue of tension in the inner cities.

She interviewed inner-city youth throughout New York while conducting research and found that many have a “profound fear of police.”

“Yet at the same time they do not hate police,” she said. “They just want better police.”

She said she also believes there is a fear in many police officers “especially the good ones” that there is a danger in every encounter.

Shortly after the Dallas police shooting, the then-Police Chief David Brown addressed protesters.

“Become a part of the solution,” Brown said. “We’re hiring. Get off that protest line and put an application in. And we’ll put you in your neighborhood, and we’ll help you resolve some of the problems you’re protesting about.”