Police run towards a building near the Dallas police department's headquarters after a man was spotted standing on the ledge of the building on July 10, 2016 in Dallas, Texas. Photo by Spencer Platt/Getty Images)

An ambush shooting that killed five police officers in Dallas last week was the deadliest incident for law enforcement since the terrorist attacks on Sept. 11, 2001. And it happened in a state with lax gun laws — an issue that is increasingly a concern for police.

Many law enforcement leaders, including police officials in Texas, have recently pushed back against the loosening of gun laws in many conservative states. Police groups, such as the International Association of Chiefs of Police, have supported measures including reinstating a federal ban on assault weapons and broadening background checks. That may be for good reason. As the Washington Post pointed out, research has shown more police officers die in states with more guns.

Using FBI data, and correcting for a number of factors like overall violence and crime rates in the state, a 2015 study by researchers at Harvard University and Johns Hopkins University​ found that "officers in the high-gun states had 3 times the likelihood of being killed compared with low-gun states."

The study published in the American Journal of Public Health looked at a 15-year period. Over that time, a 10 percent increase in gun ownership correlated to 10 additional officer homicides.

"Higher levels of civilian gun ownership appeared to be a significant risk factor for the homicide of [law-enforcement officers," the study concluded.

Dallas police have described confusion as the attack unfolded Thursday. Their job was made more difficult since 20 to 30 marchers were openly carrying AR-15 style weapons at the protest where the shooting happened. The protest was against the recent shootings of African-American men by police in Louisiana and Minnesota. As the shooting at the protest played out, the marchers carrying AR-15s ran, Dallas police chief, David O. Brown, said on CNN Sunday.

"Someone is shooting at you from a perched position, and people are running with AR-15s and camo gear and gas masks and bulletproof vests, they are suspects, until we eliminate that," Brown said. "Doesn’t make sense to us, but that’s their right in Texas."