Downtown Dallas was in lockdown early Friday after what appeared to be one attacker shot 12 officers, five fatally, during a protest over deadly police shootings of black men elsewhere.

The suspected shooter was identified as Micah Xavier Johnson, age 25, a senior law enforcement official told NBC News. Johnson is from the Dallas area and had served in the Army Reserves for six years with a tour of duty in Afghanistan, NBC news reported. The suspect exchanged gunfire with authorities in a parking garage at El Centro College into the morning, Dallas Police Chief David Brown said. He was killed by a detonation device in the standoff with police, Brown said. Three other people had been detained in connection with the shootings, but officials didn't name them or say why they were being held, the New York Times reported. The Dallas police chief said his department would not reveal names, or how many suspects there are in the ongoing investigation.

Earlier, officials said 11 officers were shot, and updated the total later in the morning. The "ambush-style" attack began around 9 p.m. local time, when the sniper fired at police officers from an elevated position, the Dallas Police Department said. It appeared to be the deadliest attack on law enforcement in the U.S. since the 9/11 attacks. The White House said investigators in Dallas have ruled out any connection to terrorist investigations, according to Reuters. Dallas Police Chief Brown shared comments from the suspect during a press conference Friday morning. Police negotiated with the suspect for hours before sending in a robot equipped with a bomb, which eventually killed the shooter, Brown said. Police said that portions of the crime scene locations in downtown Dallas will remain closed to the public until Wednesday. Detectives found bomb making materials, ballistic vests, rifles, ammunition and a personal journal of combat tactics while searching the suspect's home. The police said that detectives are in the process of analyzing the information in the journal.

Micah Xavier Johnson Source: U.S. Army

During negotiations, the shooter told Dallas police "he was upset about 'Black Lives Matter.' He was upset about the recent police shootings. He was upset at white people," Brown said at the press briefing. The suspect also said he wanted to kill people, "especially white officers," but was not affiliated with any particular group and "did this alone," Brown said. "We're hurting," Brown said. "This most stop. This divisiveness between our police and our citizens." Cleveland police officials tightened security plans for the upcoming Republican National Convention in response to the attacks, Police Chief Ed Tomba told Reuters. New York City Mayor Bill de Blasio said NYPD officers are also taking more precaution following the events in Dallas. Police officers will be paired up for safety, and will not patrol alone, as demonstrations in New York are expected to continue in response to shootings elsewhere this week. Attorney General Loretta Lynch called it an "unfathomable tragedy," and said the Department of Justice is working closely with its local counterparts in Texas. "After the events of this week, Americans across the county are feeling a sense of helplessness, of uncertainty and of fear," Lynch said, adding that the answer "must not be violence." "We must continue working to build trust between communities and law enforcement." House Speaker Paul Ryan addressed the Dallas shooting during a House session Friday morning, and said there is "no cause under which this violence is justified." "It's been a long month for America. We have seen terrible, senseless things," Ryan said. "Every member of this body, every Republican and every Democrat, wants to see less gun violence."

Earlier Friday, U.S. President Barack Obama called the attacks "vicious" and unjustifiable. "We still don't know all the facts but we do know that there has been a vicious, calculated and despicable attack on law enforcement," he said, speaking after meeting with European Council President Donald Tusk and European Commission President Jean-Claude Juncker on the sidelines of a NATO summit in Warsaw, Poland. "We are horrified over these events and we stand unified with the people and the police department in Dallas," he added. "There is no possible justification for these kinds of attacks. Anyone involved will become accountable and justice will be done," he said. At the news conference held close to 2 a.m. EDT, Brown said a suspect, who was holed up in a second-floor garage in the city's downtown area, was exchanging gunfire with police and "not being very cooperative." "The suspect we're negotiating with ... has told our negotiators that the end is coming and he's going to hurt and kill more of us, meaning law enforcement, and that there are bombs all over the place and downtown, so we're being very careful with our tactics, so we don't put our officers in harm's way, or the citizens," Brown said. KXAS reported later that the threat had been "neutralized." He said a woman had been taken into custody after she was observed by police carrying a camouflaged bag, which she put into a car that then sped off. The vehicle was stopped by police and they were currently questioning two occupants, Brown said.

A view of the downtown Dallas area from the KXAS/NBC news helicopter, as police swarm the area. KXAS | NBC News

Initially, the police chief had said the shootings appeared to be coordinated and planned, as the moves displayed a knowledge of the rally's intended path through the city and an attempt to "triangulate" police.

The Dallas Police Department made a number of statements and tweets throughout Thursday night, as the death toll rose and police exchanged gunfire with the suspect. Twelve officers were shot in total and five have died so far — three from wounds sustained during the sniper attack and one during a subsequent gun fight. It was not clear when the fifth deceased officer was injured.

Initially, Brown had also released a photograph of a "person of interest." That person had turned themself in, a later statement said.

KXAS reported that several hundred people had gathered on Thursday evening in Belo Garden Park in the Texas city's downtown area before marching to the Old Red Courthouse, where the rally ended just before shots were heard about about 9 p.m. local time.

Scene outside Parkland Hospital. Large number of police cars outside ER.

Multiple reports of the incident appeared on Twitter, including video apparently showing a police officer lying on the ground next to several police cars. 2 Police officers have been shot in downtown Dallas: Officer at scene

The attack on police occurred as protests were held in several cities over the shooting deaths of Alton Sterling in Louisiana on Tuesday and Philando Castile in Minnesota on Wednesday. Reuters reported that several hundred protesters blocked traffic in Time Square in New York City on Thursday evening, chanting "Hands up, don't shoot," and other slogans. The newswire said that there also protests in St. Paul, Minnesota, and in Chicago and several smaller cities, adding that other rallies, including one in Atlanta, were planned for Friday. Weekend protests as far away as London were being discussed on Twitter, Reuters said.

A Facebook Live steam of the moments immediately after Castile was shot by a police officer in Minnesota was shared thousands of times on the site and other social media platforms.

Diamond Reynolds weeps after she recounts the incidents that led to the fatal shooting of her boyfriend Philando Castile by Minneapolis area police during a traffic stop on Wednesday, at a "Black Lives Matter" demonstration in St. Paul, Minnesota, U.S., July 7, 2016. Eric Miller | Reuters

The video, posted on Facebook by Castile's girlfriend, Diamond Reynolds, showed Reynolds and Castile in a car, with Castile bloodied by gunshot wounds and apparently losing consciousness, as a police officer pointed a gun and screamed through the car window at the pair. Castile, a 32-year-old school cafeteria manager, died shortly after in a hospital. Castile's death came just a day after the killing of Sterling, a Louisiana man, by a police officer was also captured on video by a bystander and shared widely on social media. Sterling was selling CDs outside a convenience store when he was approached by police, who had been summoned to the scene by a 911 call. The video of the event appeared to show that the 37-year-old was shot while pinned to the ground by two officers. The U.S. Department of Justice has opened an investigation into the death of Sterling, while the Minnesota Bureau of Criminal Apprehension is investigating Castile's shooting. Dow Jones reported that state investigators had identified the police officer who shot Castile as Jeronimo Yanez.

According to a tally by The Washington Post, police officers shot dead 491 people in the first six months of 2016, up from 465 in the same period in 2015. More officers were also shot and killed in the line of duty — 20 in the first six months of 2016, compared with 16 in the same period last year — the newspaper reported. Black people were shot at 2.5 times the rate of white people, according to the Post's tally, which also found that less than 10 percent of those killed by police were unarmed, and one-quarter were mentally ill. White House spokesman Josh Earnest said that Obama had been updated on the shootings in Dallas. Speaking earlier in Warsaw, Obama commented on the deaths of Sterling and Castile, saying the police shootings weren't "isolated incidents." "They're symptomatic of a broader set of racial disparities that exist in our criminal justice system," he said, calling Americans to work together to solve the issue rather than letting it "degenerate into the usual political scrum."