Baton Rouge killer's anger at police revealed in videos

The decorated ex-US marine sergeant who opened fire on police in Baton Rouge recently recorded a video in which he hinted at an attack and claimed he would be acting alone.

Gavin Long, who served for his country in Iraq, said he was angered by the mistreatment of blacks.

He carried out the killings on the day of his 29th birthday in an ambush-style attack before being shot dead.

Louisiana state police confirmed Long was "certainly seeking out police" to kill when he set out armed on Sunday morning.

The prolific social media user - who posted under the name Cosmo Setepenra - had uploaded videos on YouTube last week after attending protests in Dallas following the police killings of two black men that sparked national outrage.

In the recording, Long told the camera only violence and financial pressure would bring about change as he hinted at plans for an attack.

"It's only fighting back or money. That's all they care about," he said. "Revenue and blood, revenue and blood, revenue and blood."

In a separate video, he said that should "anything happen" to him he wanted his viewers to know he was "not affiliated" with any particular movement or group.

"I'm affiliated with the spirit of justice, nothing more nothing less," he said. "I thought my own thoughts, I made my own decisions."

The Pentagon confirmed Long, who was from Kansas City, Missouri, served in the marines from August 2005 until August 2010, rising to the rank of sergeant.

The "data network specialist" was deployed to Iraq from June 2008 until January 2009, earning several medals and commendations, before being honorably discharged in 2010.

Details of Long's civilian life remain sketchy.

A 2009 marriage to wife Aireyona Hill ended in 2011, according to Missouri court documents, before he briefly attended the University of Alabama in 2012 for a term.

A shootout with police ensued after Gavin Long launched the morning ambush attack on officers. Credit: Reuters

He changed his name to Cosmo Ausar Setepenra last year and pledged allegiance to the Washitaw Nation, a group of African Americans that claim to be a sovereign Native American nation.

He was understood to be behind the Twitter account Convos With Cosmo in which he listed himself as a "freedom strategist, radio host, mental game coach, alpha preneur, author, world explorer, former Marine and of Ethiopian bloodline".

It is understood Long spent time in Africa in 2015, visiting Egypt, Ethiopia, Kenya and Uganda.

Long, who had no criminal record in Louisiana, dressed in black while wearing a ski mask and armed himself with a rifle before opening fire on police at 9am on Sunday, killing three officers.

He was shot dead minutes later in a gunfight with police.

His final Twitter message, written on the morning of the attack, made a thinly veiled reference to his impending death.

Long is believed to have acted alone, contrary to early reports that police may have been looking for other shooters.

Police said they have spoken to people who had contact with him and appealed for others to come forward.

The ambush shooting followed the recent attack in Dallas by fellow US army veteran Micah Johnson, who served in Afghanistan, that killed five officers.