When five police officers were killed and nine wounded in an attack during a protest march in Dallas on July 7, it rattled the nation.
Ten days later, three officers were killed and three injured in Baton Rouge, La., as they were responding to a call about a suspicious person with an assault rifle.
Between the two attacks, law enforcement officers from Georgia to Michigan were shot in incidents that drew far less attention but have added to the growing sense that it's a dangerous time to be a cop.
With the Dallas shootings, 31 law enforcement officers have died in the line of duty so far this year, compared with 18 officers who had died at this point in 2015, according the statistics from the National Law Enforcement Officers Memorial Fund.
Nick Breul, director of research for the memorial fund and a former Washington, D.C., police officer, said that there have also been a number of surprise attacks targeting and killing police officers.
"As we see increases, it becomes very concerning, particularly when you see increases in the cases of the nature of Dallas," Breul said.
"Certainly there is a climate now -- and the Dallas case indicates that there is a climate now -- that certainly should have police on guard," he added.
A black Army veteran, Lakeem Keon Scott, targeted police in a shooting on July 7 along a highway in Bristol, Tenn., authorities said. One woman was killed and three other people were injured, including one officer who is white. Scott was charged with one count of first-degree murder and seven counts of attempted first-degree murder.
"Preliminarily, the investigation reveals Scott targeted individuals and officers after being troubled by recent incidents involving African Americans and law enforcement officers," authorities from the Tennessee Bureau of Investigation said in a statement.
An officer in the St. Louis suburb of Ballwin, Mo., was shot from behind and critically injured during a traffic stop while he was walking back to his patrol car on July 8, the day after the Dallas shooting.
"A direct attack on an officer like this is not common. It was a very open and very blatant ambush," said Officer Benjamin Granda of the St. Louis County Police Department. The officer is white and the suspected shooter is black, but Granda declined to speculate about whether the attack had racial overtones.
The same day in Valdosta, Ga., a shooter lured an officer to his house with a 911 call and then opened fire, authorities said. The man, a recovering drug addict, said he "wanted the police to shoot him as he wanted to die," according to a Georgia Bureau of Investigation news release. Both the shooter and the officer survived bullet wounds, authorities said.
Also on July 8 in Georgia, another officer on patrol became a target when a motorist pulled up and fired at him in Roswell, north of Atlanta. The officer was not injured, and a suspect was taken into custody. But authorities have not commented on the gunman's motives.
Roswell Det. Zachary Frommer told WSB-TV news that officers were already on high alert after the attacks in Dallas.
"Then something like this happens and it just perks us up even more," Frommer said.
The violence continued after the weekend when two court bailiffs, both former policemen, were shot and killed by an inmate inside the Berrien County Courthouse in Michigan. A sheriff's deputy in the courthouse was wounded, and the gunman was later shot and killed.
Kim Fowler, a former law enforcement officer who knew both the slain bailiffs, said that growing violence is a danger to police, but officers try not to dwell on the risks when they are doing their job.
"They can't sit around thinking about it, and they don't," he said. "All you can do is try your best to prepare. You can't stop doing your normal activities or your everyday police work in taking care of the public."
July 17, 3:47 p.m.: This article was updated with the deaths of three police officers in Baton Rouge, La.