A gunman who attacked law enforcement officials Sunday killing three police officers and injuring three others in Baton Rouge, Louisiana, went on an online rant over the use of force against black people by white officers. The shooter has been identified as 29-year-old black male Gavin Eugene Long, a retired Marine from Kansas City, Missouri.

According to reports, just days before going on his shooting rampage in Baton Rouge, Long posted a series of videos under the pseudonym "Cosmo Setepenra" about perceived law enforcement injustices against black people. In one of the videos, Long also defended the Dallas shooter who killed five police officers on July 7.

“It’s justice,” Long said in a video. “You know what I’m saying?”

According to the New York Daily News, Long wrote in a recent Facebook post: “Violence is not THE answer (it is a answer), but at what point do you stand up so that you and your people don’t become the Native Americans...EXTINCT?”

Long posted a cryptic message on a Twitter page using the Setepenra identity just hours before Sunday's attack.

“Just bc(because)you wake up every morning doesn’t mean that you’re living,” he wrote. “And just bc(because) you shed your physical body doesn’t mean that you’re dead.”

Long also was in Dallas in the wake of the police shootings during a Black Lives Matter rally. He rented a car in Kansas City and drove to Baton Rouge to carry out the attacks on his 29th birthday, authorities reportedly said.

Long, who was armed with an assault rifle, wore a mask and body armor as he opened fire on police. 

The three officers who were killed Sunday have been identified as Deputy Brad Garafola and police officers Montrell Jackson and Matthew Gerald. He was later shot dead.