The gunman behind a sniper-style attack in Dallas was an army veteran and a loner driven to exact revenge on white officers after the recent deaths of two black men at the hands of police, authorities said on Friday.
Micah Johnson, 25, had no criminal history, Dallas police said in a statement.
Police found bomb-making materials and other weaponry at his suburban home following his deadly rampage on Thursday night at a rally held to protest this week's fatal shooting of two black men by the police in other states.
Johnson told negotiators during an hours-long standoff he was upset about the deaths and wanted to kill white people, "especially white officers", Dallas police chief David Brown said.
Five policemen were shot dead and seven were wounded, as were two civilians. Johnson was killed by a bomb carried by a police robot device.
There were no links to domestic or international terrorism and Johnson appeared to have acted alone, authorities said.
However, a Facebook page attributed to Johnson showed 'likes' for violent black militant movements classified as hate groups.
A search of the gunman's home in suburban Dallas turned up "bomb-making materials, ballistic vests, rifles, ammunition, and a personal journal of combat tactics", police said, adding that detectives were analysing the information in the journal.
"Information provided through the course of the investigation indicates that the suspect was an army veteran and others have identified him as a loner."
Johnson served six years as a private in the army reserve and was in Afghanistan from November 2013 to July 2014, the army said. He was a carpentry and masonry specialist.
Dallas police said Johnson's Facebook page referred to Richard Griffin of the rap group Public Enemy, aka Professor Griff, who the department said "embraces a radical form of Afrocentrism".
A photo on Johnson's Facebook page shows him with his right fist raised in a pose reminiscent of the black power movement of decades ago in America.
In the photo, Johnson was wearing a colourful African-style tunic against the backdrop of the red, black and green Pan-African flag, which became popular during the black liberation drive of the 1960s in the United States.
AFP viewed screen shots of Johnson's Facebook page after the social media company took it down on Friday.
His 'likes' included the New Black Panther Party (NBPP) and the Nation of Islam, organisations listed as hate groups by the Southern Poverty Law Center, which studies such movements in the United States.
Both groups are known for expressing virulently anti-Semitic and anti-white views, the SPLC said in a statement.
Another of his 'likes' is a group called the African American Defense League.
One of that organisation's leaders is a self-described psychotherapist, poet and black nationalist named Mauricelm-Lei Millere.
After this week's police shooting death of a black man named Alton Sterling in Baton Rouge, Louisiana, Millere called for violent retaliation by blacks.
He did so in a posting on the league's Facebook page.
"You and I know what we must do and I don't mean marching, making a lot of noise, or attending conventions," it said. "We must 'Rally The Troops!' It is time to visit Louisiana and hold a barbeque. The highlight of our occasion will be to sprinkle Pigs Blood!"