A peaceful protest over the recent fatal shootings of two black men by police spiraled into chaos on Thursday night in Dallas, as gunmen opened fire on law enforcement officers monitoring the crowd.

Five police officers, including one transit officer, have died. Another seven officers were also struck by bullets, as were two civilians, including a woman who was hit as she shielded her children.

In videos posted on social media, the sound of gunfire is deafening. One video apparently shows a gunman shooting a police officer in the back.

The march was convened by a white minister and a black activist, each of whom denounced the attack.

“We want Dallas to know that violence of any kind we condemn,” Dominique Alexander, founder of Next Generation Action Network, told the Dallas Morning News. “We continue to stand with the families of these officers and pray with them, as well as we stand with the families of Alton Sterling and Philando in Minnesota.”

“They teach you so much about organizing,” said Dr. Jeff Hood, “but they don’t teach you about this.”

President Barack Obama decried the “vicious, calculated and despicable attack on law enforcement.” He added that “there’s no possible justification for these kinds of attacks, or any violence against law enforcement.”

The attacker was killed last night after a standoff with police devolved into gunfire, which led police to send in a robot equipped with a bomb and detonate it.

At a press conference Friday morning, Dallas Police Chief David Brown said one of the attackers told negotiators he was angry about the recent spate of police shootings, and that he was targeting white people, especially white officers.

Below, six pieces of key context to keep in mind as more details emerge.

The Dallas ambush was the worst targeted shooting of law enforcement officers in recent memory.

The Dallas attack claimed the most police lives since 9/11, when 71 police officers died in New York, according to the National Law Enforcement Officers Memorial Fund.

The deliberate killing of police officers is rare. Since 2000, according to FBI statistics, 791 police officers have been killed feloniously — an average of 55 per year. So far in 2016, 26 officers have died in firearm-related incidents, an increase of 44 percent over the same period last year. (This accounting includes officers who died in Dallas.)

As Vox reports, Thursday’s shooting may drive up the number of police fatalities this year, but does not mean that attacks on police are increasing.

The plurality of felonious killings happens during arrests — especially of robbery or burglary suspects. But the second-most-common circumstance in which officers were feloniously killed, over the last 10 years for which data is available, is “ambush situations”: unprovoked attacks on police officers, like the Dallas attacks.

From 2004 to 2014, 118 officers were killed in ambush situations. That accounts for about 21 percent of all felonious killings during that time. In five of those years, 15 or more officers were killed in ambushes.

Other notable ambushes include an incident in a suburban Seattle coffee shop in 2009, when four officers were gunned down.

Last night’s shooting came 13 months after a man in an armored truck used a semi-automatic weapon to spray bullets at Dallas Police headquarters.

One of the gunman was armed with a semiautomatic rifle, though the exact model is unknown.

CBS News reports that Johnson wore body armor in the attack, and was armed with an SKS semiautomatic rifle and a handgun.

One witness, who filmed a suspect gunning down a police officer at point-blank range, told CNN that the gunman was armed with an AR-15-style rifle. He also reported seeing the gunman empty multiple magazines. “They weren’t short mags,” he said. “They were high-capacity magazines.”

So far, police have only said the suspect used a rifle in the attack.

Shootings carried out with assault-style weapons inevitably lead to renewed cries to ban these types of firearms. As the The Trace has reported, many experts believe that limiting access to high-capacity magazines, which allow shooters to fire dozens of rounds without reloading, could be a more effective means of reducing the amount of damage a shooter is able to inflict.

Police initially considered an open-carrier as a suspect.

Soon after the shootings took place, Dallas police released a photo of a young African American man who had attended the rally and identified him as a suspect. He was dressed in a camouflage t-shirt and was openly carrying an AR-15. It was later revealed that he was not one of the gunmen; he was the brother of the man who organized the rally.

The open carrier, named Mark Hughes, had turned his weapon over to an officer without incident before the photo was released.

The episode highlights a new potential hazard for Texas law enforcement. On January 1, despite widespread opposition from police, it became legal for permit-holding residents in the state to openly carry their guns in public.

Three quarters of 285 police chiefs who responded to a survey in early 2015 said they were opposed to open carry. Many police said that the law would increase the dangers of policing, and perhaps heighten tensions between law enforcement and civilians.

“So when a person is openly carrying a handgun, how are officers supposed to know if that person has the lawful right to own and carry that firearm?” Houston police chief, Charles McClelland, told The Trace in October. “They have no way of knowing.”

The suspect was a local resident, and had no criminal history.

The suspect, who was killed by police in a standoff last night, was Micah Xavier Johnson, 25, a resident of the Dallas area.

Johnson had been a member of the U.S. Army Reserve, and served one tour in Afghanistan in 2004, The Daily News reports.

The shooter targeted a police department that has seen remarkable success in reducing the number of complaints against officers, and shootings by police officers.

Between 2009 and 2014, excessive force complaints against the Dallas Police Department plummeted 64 percent, Buzzfeed News reports. The drastic drop is attributed to a new wave of de-escalation tactics and community-focused policing implemented when Chief Brown took his post in 2010.

Here’s Buzzfeed’s breakdown of the numbers:

In 2009, the department received 147 excessive force complaints and made 74,000 arrests. Within three years, arrests were down to 61,000 and within five years excessive force complaints were down to 53. As the number of excessive force complaints and arrests declined, so did the city’s murder rate, which reached its lowest point in more than 80 years in 2014, before ticking back upwards in 2015.

Officer-involved shootings have also seen a decline. According to Mayor Mike Rawlings, last year the city recorded the fewest officer-involved shootings of any large American metropolis.

“This police department trained in de-escalation far before cities across America did it,” Rawlings said on Friday morning. “We’re one of the premier community policing cities in the country.”

So far this month, 18 police officers have been shot in the line of duty

In the seven days leading up to the shooting, five officers across the country were shot and wounded in the line of duty. The day after the Dallas shooting, two officers were wounded, and one was fired upon but not injured.

July 3

Hillsdale, Missouri: A police officer was shot twice and wounded trying to apprehend a suspect.

July 4

North Charleston, South Carolina: A police officer was shot and wounded while trying to arrest an erratic driver, who was later killed by police.

July 7

Bristol, Tennessee: Police officer Matthew Cousins was wounded when someone opened fire at random near a Days Inn. One person was killed and three others were injured. The gunman told police he was angry about police violence targeted at African-Americans.

Dallas, Texas: Five officers were killed and seven were wounded during a sniper attack at a police brutality protest in downtown.

July 8

Roswell, Georgia: A police officer was shot at during an early-morning patrol.

Ballwin, Missouri: A police officer was shot three times in the neck and critically wounded at a traffic stop.

Valdosta, Georgia: A police officer was shot multiple times and wounded after being ambushed by a man who had called 911 to report a break-in.

[Photo: AP/Tony Gutierrez]