Authorities said on Friday the suspect, identified as Micah Johnson, 25, was killed by a bomb-carrying robot deployed against him in a parking garage where he had holed up, refusing to surrender during hours of negotiations with police.
Thursday night's bloodshed, which shattered an otherwise peaceful protest denouncing two fatal police shootings of black men in Louisiana and Minnesota this week, added a new layer of apprehension to emotional national debates over racial injustice and gun violence.
Seven other officers and two civilians were wounded in the ambush in downtown Dallas. The five killed marked the highest death toll for U.S. police in the line of duty from a single event since the Sept. 11, 2001, suicide hijackings that leveled the World Trade Center Twin Towers in Manhattan.
The latest violence was especially devastating for Dallas, which struggled for decades to heal scars left by the 1963 assassination of President John F. Kennedy, blocks away in Dealey Plaza.
But Thursday's attack reverberated across the country, prompting both major political parties' presumptive presidential nominees - Democrat Hillary Clinton and Republican Donald Trump - to cancel campaign events on Friday.
Police in Cleveland said they were tightening security plans for next week's Republican National Convention, which caps a political season marked by incendiary rhetoric and occasional violence at campaign rallies.
Other police departments across the country, including New York, Chicago and St. Louis, responded to the attack by requiring officers to patrol in pairs rather than alone.
Undaunted by events in Dallas, thousands of protesters took to the streets in several U.S. cities on Friday for a second day of protests over the deaths of Philando Castile, 32, near St. Paul, Minnesota, on Wednesday, and Alton Sterling, 37, in Baton Rouge, Louisiana, on Tuesday.
Dallas Police Chief David Brown disclosed that the gunman cited his anger over the two killings during his protracted negotiations with police.
'WANTED TO KILL WHITE PEOPLE'
"The suspect said he was upset at white people. The suspect stated that he wanted to kill white people, especially white officers," said Brown, who is African-American.
It was at the end of a rally in Dallas that gunshots crackled on Thursday night, sending hundreds of demonstrators, and police officers patrolling the march, scurrying for cover. Police initially believed they had come under attack from multiple shooters.
By late Friday, however, investigators had concluded that Johnson, armed with a rifle, was the lone gunman.
U.S. Homeland Security Secretary Jeh Johnson told reporters there appeared to be "no known links to, or inspiration from, any international terrorist organization." Still, officials said they were looking for evidence of any possible co-conspirators.
A search of the gunman's home just outside Dallas found bomb-making materials, ballistic vests, rifles, ammunition and a personal journal of combat tactics, though he had no previous criminal history, police said.
But police said social media entries showed he subscribed to a militant black nationalist ideology, including an anti-white diatribe posted last week on a Facebook page of a group called the Black Panther Party Mississippi.
The U.S. Army said Johnson had served as a private first class in the Army Reserve and was deployed to Afghanistan from November 2013 to July 2014. It said Johnson served from March 2009 to April 2015, and was a carpentry and masonry specialist with the 420th Engineering Brigade based in Texas.
President Barack Obama called the Dallas shootings "a vicious, calculated and despicable attack on law enforcement." He planned to visit Dallas early next week, at the mayor's invitation, the White House said.