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.
Authorities said on Monday that two rifles and a handgun were recovered from the scene.
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.
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 defining moment? Analysis by Laura Bicker, BBC News, Baton Rouge
Baton Rouge is in pain once more. But in a city now so full of hurt, the rift between police and the black community seems as wide as ever. Mayor Kip Holden has said the shooting may be a defining moment in community relations. But will it fuel the distrust and anger between the two sides or is it a moment for that to be set aside and solutions found?
I met protesters and black leaders in the city horrified at the violence. Cleve Dunn Jr, who has been helping organise some of the peaceful protests in Baton Rouge, told me that if you feel hurt in your heart for the death of Alton Sterling, then you feel hurt in your heart for the fallen officers. But he said there was still an issue to be addressed and they were meeting to discuss what future demands they would have of a police force they felt was too quick to judge a black man as dangerous.
The police are focussed on the investigation and the very real fear this gunman was enacting some kind of revenge. The force was already on edge during the days of demonstrations. How do they now tell friend from foe if there are further protests?
One of the key messages has come from the brother of Montrell Jackson, the black officer killed on Sunday. It is time to end this madness, he told a national radio station. The problem is - no one seems to know how.
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.
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.
President Obama called for everyone to "focus on words and actions that can unite this country rather than divide it further".
Mayor Holden told local media the "rhetoric from some people" after the death of Alton Sterling in Baton Rouge could be connected.
"Everything's been anti-police," he said, but added that the "overwhelming number of people" were "not buying into their rhetoric".
US Attorney General Loretta Lynch said federal law enforcement agencies were "determined to do everything we can to bridge divides, to heal rifts, to restore trust, and to ensure that every American feels respected, supported, and safe".