Baton Rouge police car
Baton Rouge police carReuters

The African-American gunman, who killed three police officers and injured three others in Baton Rouge, Louisiana, has been identified as Gavin Long, 29, from Kansas. He was a former Marine who had been on tour in Iraq in 2008.

Long was killed at the scene after he fatally shot three police officers. He had used an AR-15 style semi-automatic rifle, CNN reported. Long worked as a data network specialist in the Marines. He was a sergeant in the Marines, USA Today quoted Pentagon officials as saying.

The Louisiana state police said that they had received threats last week, CNN reported.

Baton Rouge has also seen "Black Lives Matter" protests in the past weeks. This is the second incident in July where police officers were targeted after the deaths of two African-American men, Alton Sterling and Philando Castile, who were shot by policemen in Louisiana and Minnesota, respectively. On July 8, in a revenge attack, five cops were shot by a former African American Army veteran in Dallas amid protests against deaths of the black men.

According to police sources, the deceased officers are Montrell Jackson, Matthew Gerald and Brad Garafola. Another officer, who was wounded, is critical and fighting for his life, East Baton Rouge Parish Sheriff Sid Gautreaux was quoted as saying by CNN.

Reports said that Long was a prolific social media user, with numerous podcasts, tweets and videos under his pseudonym Cosmo Setepenra. He reportedly talked about "fighting back" in videos published on July 8 and 10.

He called the Dallas shooter as "one of us." The police is also investigating if Long was alone or he had associates who were involved in hatching the plot to kill the policemen.

One of the deceased officers, Jackson was African-American, who had recently shared on social media that he was tired physically and emotionally since protests began in Baton Rouge after Sherlington was shot dead on July 5.