The gunman who shot six police officers, killing three of them, has been named as former US Marine Gavin Eugene Long.

Long, 29, is believed to have been the sole shooter suspected of ambushing officers in Baton Rouge, Louisiana, after they were lured there by reports of gunfire just before 9am on Sunday.

Image: Gavin Long shot six police officers in Baton Rouge

He was from Kansas City, Missouri, and served in the Marines from August 2005 until August 2010, according to The New York Times.

The newspaper, quoting the Marines' deputy public affairs officer Yvonne Carlock, added that he was deployed on a tour of Iraq between June 2008 and January 2009.

He was listed as a "data network specialist".


Baton Rouge: Panicked 911 Call

He left the Marines with an honourable discharge, a number of service medals - including one for good conduct - and the rank of sergeant in 2010, CBS reported.

Court records in Missouri show that he divorced his wife the following year and that he had no children at that time.

He also had no criminal record in the state but he was a defendant in a case involving delinquent city taxes, which was filed in March and dismissed in June.

Image: Gunshots in the window of a Sheriff's car in Baton Rouge, where six people were shot

He legally changed his name last year to Cosmo Ausar Setepenra and claimed to be a member of the Washitaw Nation, a group of African Americans who say they are a Native American nation.

He has been linked in reports to an account on Twitter - Convos With Cosmo - in which he describes himself as a freedom strategist, radio host, mental game coach, "alpha-preneur", author, world explorer, former Marine and of Ethiopian bloodline.

Image: Long changed his name to Cosmo Ausar Setepenra

Long attended the University of Alabama for one semester in 2012, and was reportedly on the dean's honour list that year.

A witness to the shooting said that Long, an African-American, was wearing black clothing and a ski mask as he carried an AR-15 assault rifle.