An Army veteran killed by Dallas police after he fatally shot five officers amassed a personal arsenal at his home, including bomb-making materials, bulletproof vests, rifles, ammunition and a journal of combat tactics.
The man identified as 25-year-old Micah Johnson told authorities he was upset about the fatal police shootings of two black men earlier this week and wanted to exterminate whites, "especially white officers," officials said.
He was killed by a robot-delivered bomb after the shootings, which marked the deadliest day for US law enforcement since the September 11, 2001, terrorist attacks. In all, 12 officers were shot.
In Georgia, Missouri and Tennessee, authorities said gun-wielding civilians also shot officers in individual attacks that came after the black men were killed in Louisiana and Minnesota. Two officers were wounded, one critically.
President Barack Obama will cut short his European trip and visit Dallas early next week.
He had been scheduled to return to Washington on Monday. Instead, he will leave Spain on Sunday night after meeting the interim prime minister and visiting US military personnel.
Mr Obama is currently in Warsaw, Poland, for a Nato summit.
The White House said the president will focus next week on efforts to support police officers while addressing "persistent racial disparities" in the criminal justice system.
Johnson was a private first class from the Dallas suburb of Mesquite who specialised in carpentry and masonry.
He served in the Army Reserve for six years starting in 2009 and did one tour in Afghanistan from November 2013 to July 2014, the military said.
After the attack, he tried to take refuge in a parking garage and exchanged gunfire with police, Police Chief David Brown said.
The suspect described his motive during negotiations and said he acted alone and was not affiliated with any groups, Mr Brown said.
Johnson was black. Law enforcement officials did not disclose the race of the dead officers.
The bloodshed close to where President John F Kennedy was killed in 1963.
The shooting began on Thursday evening while hundreds of people were gathered to protest against the killings in Baton Rouge, Louisiana, and suburban St Paul, Minnesota.
Mr Brown told reporters that snipers fired "ambush-style" on the officers. Two civilians were also wounded.
The authorities initially blamed multiple "snipers" for Thursday's attack, and at one point said three suspects were in custody.
But later, all attention focused on Johnson, and state and federal officials said the entire attack appeared to be the work of a single gunman.
With the lone shooter dead, Mayor Mike Rawlings declared that the city was safe and "we can move on to healing".
He said the gunman wore a protective vest and used an AR-15 rifle, a weapon similar to the one fired last month in the attack on an Orlando, Florida, nightclub that killed 49 people.
In Washington, the nation's senior law enforcement official, Attorney General Loretta Lynch, called for calm, saying the recent violence cannot be allowed to "precipitate a new normal".
She said protesters concerned about killings by police should not be discouraged "by those who use your lawful actions as a cover for their heinous violence".
The other attacks on police included a Georgia man who authorities said called 911 to report a break-in, then ambushed the officer who came to investigate.
That sparked a shoot-out in which both the officer and suspect were wounded but expected to survive.
In suburban St Louis, a motorist shot an officer at least once as the officer walked back to his car during a traffic stop, police said. The officer was critically ill in hospital.
And in Tennessee, a man accused of shooting indiscriminately at passing cars and police on a highway told investigators he was angry about police violence against African-Americans, authorities said.