The man who shot dead five police officers in Dallas and wounded seven more was planning an even larger attack, the city's police chief says.
Micah Johnson, a 25-year-old military veteran, was angry with the recent killings of black men by police and wanted to kill white officers, police said.
Police chief David Brown said he was "convinced" Mr Johnson had wider plans.
He told CNN that the search of Mr Johnson's home uncovered bomb-making material and a journal in which he described practicing with explosives.
"We are convinced that this suspect had other plans and thought that what he was doing was righteous, and believed that he was going to make law enforcement ... pay for what he sees as law enforcement's efforts to punish people of colour."
Mr Brown said police were trying to find the significance of the letters 'RB' that Mr Johnson wrote in his own blood near where he was killed by a remote detonation by police.
The journal found in Mr Johnson's house had proved "hard to decipher", Mr Brown said.
Mr Johnson launched his attack in Dallas as a protest was taking place against the deaths of black men at the hands of police.
The deaths of Philando Castile in St Paul, Minnesota, and Alton Sterling in Baton Rouge, Louisiana, last week led to more protests across US cities on Saturday (US time).
Hundreds of people were arrested in the demonstrations nationwide. While most passed peacefully, fireworks, bottles and rocks were thrown at police in St Paul in clashes along a main interstate highway.
Close to 100 people were arrested there as 21 police officers were injured.
In Baton Rouge, several hundred protesters gathered outside the police department shouting "No justice! No peace!" and also at the convenience store where Alton Sterling was shot.
And there was tension as armed members of the New Black Panther Party stood face to face with officers in riot gear. Louisiana law allows weapons to be carried openly.
Among the 100 people held were three journalists and DeRay Mckesson, who has become a national voice for the Black Lives Matter movement.
"The police in Baton Rouge have been truly awful tonight," Mr Mckesson said in a livestreamed Periscope video on Saturday night.
"They have provoked people. They chase people just for kicks. The police have been violent tonight. The protesters have not.''
Other protests took place in Nashville, Indianapolis and Washington DC.
Demonstrations have continued despite an effort by President Barack Obama to soothe the tension.
While in Spain on Sunday, he demanded an end to anti-police violence.
"Whenever those of us who are concerned about fairness in the criminal justice system attack police officers, you are doing a disservice to the cause," he said.
Also on Sunday, the White House said Mr Obama would travel to Dallas on Tuesday. He will speak at an interfaith memorial service.