Five police officers were killed and seven were wounded by sniper fire Thursday night in an "ambush-style" attack in Dallas, the deadliest attack on police since 9/11.

The sniper was killed after a standoff with police, who used a robot armed with an explosive to take out the shooter.

Police initially indicated more than one gunman carried out the assault, and three other people have reportedly been detained.

The shooter killed by police has been identified as Micah Xavier Johnson, a 25-year-old former Army reservist.

During the standoff, police said Johnson indicated he wanted to kill white people, particularly white police officers. He was "upset about Black Lives Matter, he said he was upset about the recent police shootings," according to Dallas Police Chief David Brown.

ADVERTISEMENT

The killings took place during a protest against the use of deadly force by police against African-Americans and immediately fueled an already divisive national debate.

President Obama condemned the shootings as a despicable act in a statement from a NATO summit in Warsaw, Poland. 

"I believe I speak for every single American when I say we are horrified over these events, and we stand united with the people and the police department in Dallas,” Obama said. 

"Anyone involved in the senseless murders will be held fully accountable. Justice will be done."

Republican presidential candidate Donald TrumpDonald John TrumpDemocrats' CNN town halls exposed an extreme agenda Buttigieg says he doubts Sanders can win general election Post-Mueller, Trump has a good story to tell for 2020 MORE condemned the killings as an "attack on the country," while Democratic candidate Hillary ClintonHillary Diane Rodham ClintonDavis: The shocking fact that Mueller never would have accused Trump of a crime Trump says he would challenge impeachment in Supreme Court The Hill's Morning Report - Will Joe Biden's unifying strategy work? MORE mourned the officers who were “shot while doing their sacred duty.” Both Trump and Clinton canceled Friday campaign events. 

The cycle of violence quickly led to questions about the rhetoric used against police after two high-profile shootings this week of black men. 

"To say that our police officers put their lives on the line every day is not hyperbole, it's a reality," said Dallas Mayor Mike Rawlings. "We as a city, we as a country must come together, lock arms and heal the wounds that we all feel from time to time. Words matter, leadership matters at this time."

Protests and vigils were held nationwide Thursday after the shootings by police of Philando Castile in Minnesota and Alton Sterling in Baton Rouge. Both shootings were caught on camera, with the videos viewed millions of times by people on social media and television. 

The demonstrations in Dallas were sparked by those killings.

Police said that officers were targeted "ambush-style" by fire from an elevated position in a parking garage.

Two civilians were also shot and injured in the mayhem, which turned the part of the city into something resembling a war zone.

The suspect killed by police told officers that the end is coming, said Brown, adding that the suspect said he "wanted to kill white people, especially white officers."

The person had claimed to have placed bombs in the area and wanted to kill police, Brown said in explaining the decision to send in a robot armed with explosives.

“Other options would have exposed our officers to great danger,” Brown added.

The chief also defended the police presence Thursday night, saying they had "an adequate amount of officers at the scene," adding, "we won't militarize our policing standards."

"We are not going to let a coward who would ambush police officers change our democracy," Brown said of responding to protests. "Our city, our country, is better than that."

One of the deceased and three of those injured are officers for the Dallas Area Rapid Transit agency. 

Gov. Greg Abbott offered his condolences to the police department and DART in the wake of the shooting.

Updated at 9:52 a.m. July 8