Dallas police identified Micah Xavier Johnson, a 25-year-old Army veteran, as the lone gunman in the shooting.
Detectives found bomb-making materials during a search of his home.
Johnson said he was upset about recent police shootings and wanted to kill white people, especially white officers, the police chief said.
Officers detonated a robot bomb to kill Johnson after attempting to negotiate with him.
President Barack Obama called the attack “vicious, despicable, and calculated.”
DALLAS ― A day after a lone gunman shot and killed five police officers and injured another seven during a Black Lives Matter protest in Dallas, marking the deadliest day for police in the U.S. since Sept. 11, Texas Gov. Greg Abbott praised the bravery of the police force and called for a return to normalcy.
The past 24 hours have been “a veritable tale of two cities,” Abbott said in a news conference Friday evening. “On the one hand, it’s been the tale of heroism of police officers. At the same time, it’s been a tale of cowardice by an assassin."
"We need to show that we are not harmed, damaged or altered by this cowardly attack," he added.
The gunman, Micah Xavier Johnson, 25, who was killed by police, was an army veteran who said he “wanted to kill white people, especially white officers,” according to the Dallas Police Department. He had no criminal history, officials said.
The attack, which also injured two civilians, came during a violent week that also saw police shootings of black men in Louisiana and Minnesota.
Officers exchanged gunfire with Johnson after negotiating with him for several hours. They ultimately detonated C4 plastic explosive strapped to a robot bomb-detector, killing Johnson.
Detectives later searched his house and found bomb-making materials, ammunition, rifles, ballistic vests and a personal journal containing “combat tactics,” officials said.
Johnson “knew how to do his damage, but we did damage to him as well,” Mayor Mike Rawlings said.
Three additional people who had been detained as suspects were released Friday, Abbott said.
Brent Thompson, 43, who worked for the Dallas Area Rapid Transit force, was killed in the attack, as were Lorne Ahrens, 48, Michael Krol, 40, Michael Smith, 55, and Patrick Zamarripa, 32, of the Dallas Police Department.
“We’re hurting. Our profession is hurting,” Police Chief David Brown said. “Dallas officers are hurting. We are heartbroken. There are no words that describe the atrocity that occurred to our city.”
People filled Thanks-Giving Square, in the center of downtown Dallas, midday Friday for a vigil and interfaith service.
“In the end, three things remain ― faith, hope and love. We need all three today,” Rawlings said at the vigil. “We must have faith in each other, in our institutions, we must have hope that tomorrow will be better, and it will. And we must love one another.”
After the vigil ended, the downtown area was essentially empty save for the officers ― wearing black bars over their badges ― posted up on every block. Some lined up to give blood at an impromptu donation clinic inside City Hall.
All signs pointed to the Black Lives Matter demonstration having been peaceful throughout Thursday evening. The police department Twitter account included posts about “men, women, boys and girls” gathered in solidarity, while other photos show officers posing with marchers, including a state senator.
Dramatic video of the shooting showed dozens of officers converging on several buildings in downtown Dallas, including a parking garage. In another, several shots can be heard ringing out as sirens blare in the background.
“It was just an endless stream of gunshots,” Dallas attorney Allison Griswold told The Huffington Post. She watched the atrocity unfold from her living room window and posted videos on Twitter. “I started to see, later on, cops just running towards it as other people started running.”
Rawlings said Friday morning that it was “heartbreaking” to lose the police officers. “To say that our police officers put their lives on the line every day is no hyperbole, it is a reality,” he said. “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.”
President Barack Obama addressed the shootings from Warsaw, Poland, where he’d been attending a meeting with NATO officials.
“There has been a vicious, despicable, and calculated attack on law enforcement,” he said. “I think I speak for every single American when I say that we are horrified.”
Obama on Friday ordered all flags to stand at half-staff through July 12 as a mark of respect for the victims.
Hundreds had gathered in cities across the country earlier Thursday to protest this week’s police shootings of Alton Sterling, who was killed outside a convenience store in Baton Rouge, Louisiana, and Philando Castile, who was shot during a traffic stop in Minnesota.
Demonstrators were carrying signs and chanting “no justice no peace” and “hands up, don’t shoot” ― common refrains of the Black Lives Matter movement against police brutality.
Nick Visser contributed reporting.