The man identified as the killer of three US police officers in Baton Rouge had posted videos complaining at police treatment of African Americans and urging them to “fight back”.
One of Gavin Long’s videos stresses he is not linked to any group but is “affiliated with justice”.
The ex-Marine, 29, was killed by police during the attack on Sunday morning.
Tension has been high since police shot dead a black man in Baton Rouge two weeks ago.
That death – and a second police shooting in Minnesota – sparked protests across the US and triggered a revenge attack by a black army veteran who shot dead five officers in the city of Dallas.
Responding to the latest killings, President Barack Obama called upon all Americans to unite and refrain from divisive language.
- Who is the gunman?
- What we know of the shootings
- How often are US police killed on duty?
Louisiana State Police said on Monday that they had now positively identified Long as the gunman via fingerprints and said he had been “certainly seeking out police”.
Col Mike Edmonson said: “His movements, his direction, his attention was on police officers.”
More details have emerged about Long, who was from Kansas City, Missouri, including his service history.
A Marine from August 2005 until August 2010, he rose to the rank of sergeant and served in Iraq from June 2008 until January 2009, earning a number of medals and commendations. He received an honourable discharge.
His video and online postings used the pseudonym Cosmo Setepenra. He railed against what he saw as injustices against black people, at one point saying “you gotta fight back”.
In one video, posted on YouTube, Long said that should “anything happen” to him, he was “not affiliated” with any group.
One website called “convoswithcosmo” says he travelled to Dallas in the wake of the killing of the police officers there.
In a 10 July video apparently posted from Dallas, he said only violence and financial pressure would bring about change: “Revenue and blood, revenue and blood, revenue and blood. Nothing else.”
One tweet last week said: ‘Violence is not THE answer (its a answer), but at what point do you stand up so that your people dont become the Native Americans…EXTINCT?”
Sunday’s attack reportedly took place on Long’s birthday.
Police responded to reports of a man dressed in black holding a rifle behind a store. They are investigating whether an emergency call lured the officers there.
The exchange of fire lasted about eight minutes. Mayor Kip Holden said it was an “ambush-style” attack.
Col Edmonson said the gunman was believed to have acted alone.
The dead officers were named as Montrell Jackson, 32, and Matthew Gerald, 41, of the Baton Rouge police department, and Sheriff’s Deputy Brad Garafola, 45. All three men had families.
Three other officers were wounded, one of whom was in a critical condition on Monday.
It has emerged that just days before the attack Montrell Jackson posted an emotional message on Facebook about how hard it was to be a black police officer in Baton Rouge.
“I swear to God I love this city but I wonder if this city loves me,” he wrote. “In uniform, I get nasty hateful looks, and out of uniform some consider me a threat.”
President Obama said that “nothing justifies violence against law enforcement”.
“Everyone right now focus on words and actions that can unite this country rather than divide it further,” he added.