(NBC News) - A suspect who was killed by police after snipers shot 12 Dallas officers, five fatally, "wanted to kill white people, especially white officers," police chief David Brown said.

The man was killed after authorities cornered him in a garage at El Centro Community College. After several hours of negotiations, lasting into the early hours of Friday morning, officials exchanged gunfire with the suspect and "saw no other option" but to kill him by detonating a bomb, Brown said.

"Other options would have exposed our officers to grave danger," he said.

Brown said the suspect, who he would not identify, told a hostage negotiator that he was upset about the Black Lives Matter movement and the recent police shootings of black men elsewhere in the U.S.

"The suspect stated he wanted to kill white people, especially white officers," Brown said. "The suspect stated that he was not affiliated with any groups and he stated that he did this alone."

Nonetheless, officers took three other people into custody.

Dallas Mayor Mike Rawlings praised the team who took down the suspect.

"The good news: He's gone off the face of the Earth," Rawlings told MSNBC.

The city's downtown was in lockdown Friday after Thursday night's ambush, which marked the deadliest day for law enforcement since Sept. 11, 2001.

Earlier, the suspect had told police negotiators that "the end is coming" and that "there are bombs all over the place in this garage and downtown," Brown said.

President Barack Obama, who was in Poland for a NATO meeting, condemned the "vicious, callous and despicable attack."

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

In what Brown described as an "ambush-style" shooting, at least two snipers fired from an elevated positions on police officers minutes before 9 p.m. local time (10 p.m. ET).

"We believe that these suspects were positioning themselves in a way to triangulate on these officers from two different perches in garages in the downtown area, and planned to injure and kill as many law enforcement officers as they could," he told a news conference — noting that some victims were shot in the back.

Other suspects might still be at large. "We're hopeful that we have got everybody but we don't know that for sure," Dallas mayor Mike Rawlings told NBC's TODAY.

He said the suspects in custody were "being pretty tight lipped" but their motives were clear. "It's simple ... they wanted to kill police officers and sadly they did."

The FAA ordered a temporary flight restriction over Dallas and there were extensive sweeps of downtown for explosives but none were found.

Four of the five slain officers were Dallas police, and the fifth was a Dallas Area Rapid Transit officer. A civilian was also wounded, authorities said.

Around 800 people were at the demonstration, and around 100 police officers were assigned to the event and the surrounding area. The shooting occurred after the demonstration ended and as a march was taking place.

"Our worst nightmare happened," Rawlings said earlier. "It is a heartbreaking moment for the city of Dallas."

"We heard shots, we smelled gunpowder, and that's when everything got really intense and surreal," a witness told MSNBC. "We just started to run and grab kids," he said.

Police distributed a photo of a man they called a "person of interest." The person in that photo turned himself in, police said, and was later released. It does not appear he was part of the four suspects later mentioned by Brown.

Attorney General Kamala Harris said the shootings in Dallas were "a grave reminder of the dangers our law enforcement officers face each day in service of their communities."

The NYPD's Counterterrorism Bureau said in a statement it was "monitoring the developing events" in Dallas.

The demonstration in Dallas was one of several held in cities across the country Thursday over the police shootings of two black men, Alton Sterling in Baton Rouge, Louisiana Tuesday and Philando Castile Wednesday in a St. Paul, Minnesota suburb.

In St. Paul, a crowd estimated to be more than a thousand strong gathered outside a school where one of those men killed, Philando Castile, worked as a kitchen supervisor.

In Baton Rouge, mourners gathered in a "second line" parade for Alton Sterling, who was killed by police Tuesday in an incident recorded on video by a bystander. The Department of Justice has opened a civil rights investigation into that shooting.

"It can be any brother or sister out here. This ain't just started; they've been killing us," Chermicka Brown, a friend of Sterling's who joined protesters outside the store where he was shot, told NBC affiliate WVLA in Baton Rouge.