Gavin Eugene Long, the gunman who killed three police officers and wounded three others in Baton Rouge, La., on Sunday, left a vast and angry online trail documenting his interest in black separatism and fury at police shootings of black men.

Long, whose identity was confirmed by a law enforcement official, was shot to death by police after opening fire on officers on Airline Highway, less than a mile from the city's police headquarters in Baton Rouge.

One law enforcement official described him as "a black separatist." He carried out the shooting on his 29th birthday, and was from Kansas City, Mo.

It's unclear when he came to Baton Rouge.

Long went by "Cosmo" online and had registered the domain name ConvosWithCosmo.club in April using his Kansas City address. The website shows a generic page with ads but a similarly named site, ConvosWithCosmo.com, includes links to podcasts, YouTube videos, books of his for sale and various social media accounts.

In a video posted on social media, Gavin Long, the man identified by a U.S. government official as the Baton Rouge police shooting suspect, urges fighting back against oppressors. In a video posted on social media, Gavin Long, the man identified by a U.S. government official as the Baton Rouge police shooting suspect, urges fighting back against oppressors.

Throughout his postings, Long described violence as the solution to what he saw as oppression of black Americans. He railed against the July 5 police shooting of 37-year-old Alton Sterling in Baton Rouge.

"One hundred percent of revolutions, of victims fighting their oppressors, from victims fighting their bullies, 100% have been successful through fighting back through bloodshed," he said in a video. "Zero have been successful through simply protesting. It has never been successful and it never will."

In a tweet, he called violence an "answer."

"At what point do you stand up so that your people don't become the Native Americans … EXTINCT?" it said. In another tweet, he praised Micah Johnson, the man who shot and killed five police officers in Dallas, saying "he was one of us!" and "my religion is justice."

In a July 8 video, Long suggested that if "anything happens to me … don't affiliate me with anybody." In a tweet with a video, which he said was filmed with a body camera in Dallas on July 10, Long shouted at black men getting haircuts at a barber shop: "Everyone in this room got a purpose, just figure it out!"

He also wrote about his experiences as a U.S. Marine.

"While stationed in San Diego, California, Cosmo became a highly esteemed and sought after nutritionist and personal trainer," Long wrote on his website.

According to military records, Long served for five years, including deployments to Iraq for seven months in 2008 and 2009 and a post in Okinawa, Japan. Much of his time was spent in California. He worked as a data network specialist.

Reports say he was honorably discharged in 2010.

After leaving the military, he received an associate's degree in General Studies at Central Texas College and studied for three semesters at Clark Atlanta University, according to his online postings.

Long dropped out after having a "spiritual revelation," gave away "all of his material possessions" and traveled to Africa, he wrote. The website says he crisscrossed Rwanda, Ethiopia, Uganda, Kenya, Tanzania, Egypt, Ghana and Burkina Faso, and wrote three books, including a two-part series called a "A (W)holistic Guide for the Total Transformation of Melanated People."

Long's attendance at those universities could not be confirmed, but a spokesman for the University of Alabama said that a student with Long's name took classes there in 2012. He made the dean's list that spring.

Besides posting on his own sites, Long appears to have contributed frequently to other forums. On one website, a user named Cosmo Setepenra with an email address associated with Long complained about government surveillance. On stoporgangstalking.com, a user named Cosmo commented about the importance of wearing body cameras and exposing people involved in "gang stalking."

Long also appeared to follow at least one online radio show hosted by Lance Scurv, who said he featured a Cosmo Setenepra on his radio show this year in a long conversation about nutrition and health. They stayed in touch, talking on the phone every now and then. Scurv, who is based in Orlando, Fla., said Cosmo spoke from a phone number with a Kansas City area code.

"He seemed to be like a guy in transition," he said. "But he never expressed rage like there was something brewing."

On July 9, Scurv posted an email that Cosmo asked