-- The lone gunman in a shooting rampage that left three Baton Rouge, Louisiana, law enforcement officers dead and three more injured referred to the police shooting of Alton Sterling and posted videos online about using violence to "fight back."
Investigators are scouring the online trail of videos and social media posts left behind by suspected gunman Gavin Long, 29, of Kansas City, Missouri, as they look for the motive behind the deadly attack, law enforcement sources said.
Social Media Clues?
Long posted dozens of videos and podcasts on his webpage "Convos With Cosmo" in addition to regularly tweeting and posting on Twitter and Instagram under the pseudonym "Cosmo Setepenra."
In a video titled "Convos With Cosmo on Protesting, Oppression, and how to deal with Bullies" that was posted a week before Sunday’s shooting, he rants about "fighting back" against "bullies" and discussed the killings of black men at the hands of the police, referencing the death of Sterling, who was shot and killed by police in Baton Rouge earlier this month.
Long also posted about Micah Johnson, the gunman who shot and killed five Dallas officers July 7, saying on Twitter he was "one of us.”
And just hours before Sunday's deadly shooting, Long posted his last tweet: "Just [because] you wake up every morning doesn't mean that you're living. And just [because] you shed your physical body doesn't mean that you're dead."
Gavin Long's Past
Investigators initially suspected the involvement of multiple shooters, but later determined that Long appeared to have been a lone gunman.
Authorities said they positively ID'd Long as the shooter using his fingerprints.
The shooter was spotted when a citizen alerted city police — either by calling 911 or flagging officers down — to report a suspicious man with a weapon, the state police told ABC News.
Police said they recovered Long's cellphone during the altercation with law enforcement. The source said Long appeared to have rented a car in his hometown of Kansas City and drove more than 700 miles to Baton Rouge.
East Baton Rouge Sheriff Sid Gautreaux said the shooter was "definitely targeting police officers."
Law enforcement sources told ABC News that the gunman had an AR-type rifle and a semi-automatic pistol.
Long is listed on the Servicemembers Civil Relief Act (SCRA) website as having joined the Marines in August 2005 and ended active duty in August 2010.
Military records released Sunday night show Long made the rank of sergeant and was a data network specialist. He deployed to Iraq once, from June 2008 to January 2009, and also served at a Marine Corps base in Okinawa, Japan, the records say.
Federal authorities are also looking at ties Long may have had to an anti-government group that he apparently indicted support for online, according to a source familiar with the probe.
Chaotic Scene Caught on Camera
A cellphone video recorded via Facebook Live by Charmaine Adams captured the chaotic scene between police and the gunman.
Adams told ABC News today she shot the video from her car at the gas station. Adams said Long and at least one officer were shooting at each other at the scene.
"He ended up going around to the back of the car and the officer literally on our driver side of the car, shooting over us," Adams said in an exclusive interview with “Good Morning America.”
"I was actually kind of waiting for a bullet to hit me. It was that close.”
The officers killed during Sunday's attack were Brad Garafola, 45, who was a 24-year veteran of the East Baton Rouge Sheriff's Office, and Montrell Jackson, 32, and Matthew Gerald, 41, who worked for the Baton Rouge Police Department. Jackson had served in the department for a decade, officials said. Gerald had been working there for less than a year.
Three officers were injured in the attack.
The Attorney General and the President Respond
Attorney General Loretta Lynch said today, "All of us are again heartbroken at the news of yet another tragedy; shocked by such callous disregard for human life; and dismayed at yet another instance of violence tearing at the fabric of our nation."
"After the murders of five officers in Dallas two weeks ago, Officer Montrell Jackson – a black officer in Louisiana – wrote, ‘In uniform I get nasty, hateful looks – and out of uniform, some consider me a threat.’ And yet even still, he urged all Americans – of every background and circumstance, every color and creed – ‘Please don’t let hate infect your heart,’" Lynch said.
President Obama said Sunday, "nothing justifies violence against law enforcement" and said these type of attacks on public servants and police "have to stop."
Speaking for the 17th time in the wake of a domestic mass shooting, Obama once again called for Americans to unite, especially before two weeks of potentially turbulent political conventions.
We need to "temper our words and open our hearts," Obama said Sunday afternoon. "All of us. We need what we saw in Dallas this week," referring to the outpouring of support after the deaths of five officers there.
After spending the past week grappling with political and civil upheaval in the wake of the shootings in Dallas, Baton Rouge and St. Paul, Obama called on politicians who speak in the Republican and Democratic conventions to help the country move forward.
Hillary Clinton called the shooting a "devastating assault" on police officers in Baton Rouge, saying it was "an assault on all of us."
Donald Trump tweeted his condolences for the fallen officers while reiterating his call for "law and order."
Police on High Alert
Police in Boston, New York, Los Angeles, Chicago and New Orleans are on high alert.
Baton Rouge Mayor Kip Holden told ABC News this morning that police agencies across the country "should be on alert" and urged citizens to be vocal about their support for law enforcement.
"Tell people in law enforcement and others that you love them every day," Holden said on "GMA" this morning. "Unfortunately, yesterday I had the bad experience of going into a hospital room and seeing the child of one of the officers that was slain. And that little girl said this: 'I know my daddy is not dead. My daddy is going to come home tonight.' That young girl, seeing what she said, and your heart basically in your hands and all kinds of emotions going through your stomach.
"Make sure we embrace [police]. Let them know we love them. Let them know we appreciate what they are doing," Holden added.
Agencies across the country have noted an uptick in violent speech targeting law enforcement in the wake of the recent shootings. In a notice issued more than a week prior to Sunday's attack in Baton Rouge, the FBI cited social media posts calling for a "purge" of cops in that city.
The warning, issued by the FBI's New Orleans field office on July 7, mentioned "threats to law enforcement and potential threats to the safety of the general public" stemming from the July 5 shooting of Sterling.
ABC News’ Mike Levine and Jack Date contributed to this story