BATON ROUGE, LA - JULY 17:  Baton Rouge Police officers patrol Airline Hwy after 3 police officers were killed early this morning on July 17, 2016 in Baton Rouge, Louisiana. According to reports, one suspect has been killed while others are still being sought by police.  (Photo by Sean Gardner/Getty Images)
Sean Gardner/Getty Images
BATON ROUGE, LA - JULY 17: Baton Rouge Police officers patrol Airline Hwy after 3 police officers were killed early this morning on July 17, 2016 in Baton Rouge, Louisiana. According to reports, one suspect has been killed while others are still being sought by police. (Photo by Sean Gardner/Getty Images)
Now playing
01:09
Baton Rouge shooter was a former Marine
EBRDA Videos
Now playing
01:24
New video from Baton Rouge police ambush
baton rouge shooting timeline nick valencia dnt_00003328.jpg
baton rouge shooting timeline nick valencia dnt_00003328.jpg
Now playing
01:38
How the Baton Rouge shooting went down
BATON ROUGE, LA - JULY 17:  East Baton Rouge Police officers patrol Airline Hwy after 3 police officers were killed early this morning on July 17, 2016 in Baton Rouge, Louisiana. According to reports, one suspect has been killed while others are still being sought by police.  (Photo by Sean Gardner/Getty Images)
Sean Gardner/Getty Images North America/Getty Images
BATON ROUGE, LA - JULY 17: East Baton Rouge Police officers patrol Airline Hwy after 3 police officers were killed early this morning on July 17, 2016 in Baton Rouge, Louisiana. According to reports, one suspect has been killed while others are still being sought by police. (Photo by Sean Gardner/Getty Images)
Now playing
00:55
Source: Baton Rouge shooter identified
Montrell Jackson slain Baton Rouge officer
Facebook
Montrell Jackson slain Baton Rouge officer
Now playing
01:42
Slain Baton Rouge officer had written emotional post
Governor Louisiana Baton Rouge ambush police killed presser_00004906.jpg
WAFB
Governor Louisiana Baton Rouge ambush police killed presser_00004906.jpg
Now playing
01:20
Governor: The hatred just has to stop
Police gave the name of the man who shot 6 police officers in Baton Rouge on July 17 as Gavin Long. Online, he used the name "Cosmo Setepenra," and posted on a YouTube channel of that name.
YouTube/Cosmo Setepenra
Police gave the name of the man who shot 6 police officers in Baton Rouge on July 17 as Gavin Long. Online, he used the name "Cosmo Setepenra," and posted on a YouTube channel of that name.
Now playing
01:14
Baton Rouge gunman posted this video on social media
Jada Gabriel
Now playing
01:08
New video of gunfire exchange in Baton Rouge
baton rouge police shooting witness bpr_00000000.jpg
WAFB
baton rouge police shooting witness bpr_00000000.jpg
Now playing
02:10
Witness describes Baton Rouge police shootout scene
Superintendent no active shooter Baton Rouge_00002421.jpg
WAFB
Superintendent no active shooter Baton Rouge_00002421.jpg
Now playing
02:26
Police: No active shooter situation in Baton Rouge
Obama Baton Rouge shooting_00043225.jpg
Obama Baton Rouge shooting_00043225.jpg
Now playing
05:00
Obama speaks out on Baton Rouge police shooting
baton rouge pastor mark burns ebof_00001819.jpg
baton rouge pastor mark burns ebof_00001819.jpg
Now playing
01:20
Pastor Mark Burns calls Baton Rouge shooting a tragedy
Authorities talk to the driver of a car near an area where several officers were shot while on duty less than a mile from police headquarters, Sunday, July 17, 2016, in Baton Rouge, La. (AP Photo/Mike Kunzelman)
Mike Kunzelman/AP
Authorities talk to the driver of a car near an area where several officers were shot while on duty less than a mile from police headquarters, Sunday, July 17, 2016, in Baton Rouge, La. (AP Photo/Mike Kunzelman)
Now playing
03:05
Police: Scene active but contained
Now playing
02:02
Van Jones: Cops, blacks both feel targeted
FILE - In this June 25, 2010, file photo Britain's Prince Harry fires a Colt M4 assault riffle on a United States Military Academy range in West Point, N.Y.  The Defense Department is searching for the successor to the M4 combat rifle and gun makers are loading with lobbyists to win the work. Colt Defense of West Hartford, Conn., had an exclusive deal to provide M4s to the U.S. military and didnt need a hired gun looking out for its interests in Washington. (AP Photo/Chad Rachman, Pool, File)
Chad Rachman/POOL NEW YORK POST/ASSOCIATED PRESS
FILE - In this June 25, 2010, file photo Britain's Prince Harry fires a Colt M4 assault riffle on a United States Military Academy range in West Point, N.Y. The Defense Department is searching for the successor to the M4 combat rifle and gun makers are loading with lobbyists to win the work. Colt Defense of West Hartford, Conn., had an exclusive deal to provide M4s to the U.S. military and didnt need a hired gun looking out for its interests in Washington. (AP Photo/Chad Rachman, Pool, File)
Now playing
01:40
History of the modern assault-style rifle

Story highlights

Gunman Gavin Long was a prolific user of social media who used the pseudonym Cosmo Setepenra

One of slain officers had recently called for an end to hate in a Facebook post

(CNN) —  

A Missouri man ambushed and killed three law officers and wounded three others in Baton Rouge on Sunday during a time when police nationwide and in the Louisiana city in particular have been on high alert after five officers were killed in a Dallas ambush July 7.

Louisiana State Police announced last week that they had received threats of plots against Baton Rouge police.

On Sunday, a man identified as Gavin Long of Kansas City went on a shooting rampage on his 29th birthday that left two police officers and a sheriff’s deputy dead, police sources said. Long, who was African-American, was a former Marine who spent time in Iraq and was discharged at the rank of sergeant in 2010, according to the U.S. military.

Gavin Long: Who is Baton Rouge cop killer?

Police officers who responded to Sunday’s shootings killed Long in a gunbattle after the other officers were ambushed, police sources told CNN. The murder weapon was an AR-15 style semi-automatic rifle, law enforcement sources told CNN.

Police have not officially released the names of the victims but one was identified by family members as Officer Montrell Jackson. Law officers Matthew Gerald and Brad Garafola were also killed, according to sources close to the department. That was corroborated with social media posts.

The three law-enforcement officers killed in Baton Rough, Louisiana, were, from left, Montrell Jackson,  Brad Garafola and Matthew Gerald.
East Baton Rouge Sheriff's office/Facebook
The three law-enforcement officers killed in Baton Rough, Louisiana, were, from left, Montrell Jackson, Brad Garafola and Matthew Gerald.

The gunman also critically wounded a deputy who is “fighting for his life,” said East Baton Rouge Parish Sheriff Sid Gautreaux. Another wounded deputy and police officer have non-life-threatening wounds, law officers said.

Jackson had posted on Facebook on July 8 how physically and emotionally drained he had been since protests had erupted in Baton Rouge after the July 5 killing of Alton Sterling by police.

Black and blue: Double despair for African-American police

“I swear to God I love this city, but I wonder if this city loves me. In uniform I get nasty, hateful looks and out of uniform some consider me a threat. … These are trying times. Please don’t let hate infect your heart.”

Gunman made frequent web posts

Long was a prolific user of social media, with dozens of videos, podcasts, tweets and posts under his pseudonym Cosmo Setepenra. Under that name, Long also tweeted a link to a news story about Dallas shooter Micah Johnson and said the shooter was “one of us! # MY Religion is Justice.”

A law enforcement source said Long “was not alone during his stay in Baton Rouge,” but it’s unclear if others he was with knew about or were actively involved in any plot.

Police gave the name of the man who shot 6 police officers in Baton Rouge on July 17 as Gavin Long. Online, he used the name "Cosmo Setepenra," and posted on a YouTube channel of that name.
YouTube/Cosmo Setepenra
Police gave the name of the man who shot 6 police officers in Baton Rouge on July 17 as Gavin Long. Online, he used the name "Cosmo Setepenra," and posted on a YouTube channel of that name.

The FBI is running down names of possible associates, another law enforcement official said.

In YouTube videos posted July 8 and 10, reviewed by CNN, Long, using the name “Cosmo,” spoke about the need for “fighting back” and what people should say about him “if anything happened to me.”

In the July 10 video, recorded, he said, in Dallas, he says, “Zero have been successful just over simple protesting.”

“You gotta fight back,” he says on the video.

Two law enforcement sources tell CNN that Long rented a car in Kansas City after the Dallas shootings and drove it to Baton Rouge. Given that Long posted a YouTube video from Dallas on July 10, it is likely he drove to Baton Rouge via Dallas.

Calls for end to violence

Quinyetta McMillon, mother of Sterling’s son Cameron, put out a statement through her lawyers condemning the ambush.

“We are disgusted by the despicable act of violence today that resulted in the shooting deaths of members of the Baton Rouge law enforcement. My family is heartbroken for the officers and their families. … We reject violence of any kind directed at members of law enforcement or citizens.

Chief: ‘I was an African-American before I was a police officer’

My hope is that one day soon we can come together and find solutions to the very important issues facing our nation rather than continuing to hurt one another.”

President Barack Obama on Sunday condemned the killings and all attacks on law enforcement.

“We as a nation have to be loud and clear that nothing justifies violence against law enforcement,” Obama said, speaking from the White House press briefing room. “Attacks on police are an attack on all of us and the rule of law that makes society possible.” In a written statement earlier in the day, Obama called the Baton Rough shootings a “cowardly and reprehensible assault.”

’No talking, just shooting’

The shooting Sunday took place around 8:40 a.m. (9:40 a.m. ET) in the city of about 230,000 people, already tense after the high-profile police shooting of Sterling, an African-American man, on July 5.

Image from Google Earth

On Sunday, police received a call of a “suspicious person walking down Airline Highway with an assault rifle,” a source with knowledge of the investigation told CNN.

When police arrived, the shooting began.

“There was no talking, just shooting,” Baton Rouge Police Cpl. L.J. McKneely said.

At an afternoon news conference, local and state authorities, including Louisiana Gov. John Bel Edwards, said Long was thought to be the lone gunman. Earlier reports had said authorities believed there might have been more than one attacker. Edwards described the shooting as an “absolutely unspeakable heinous attack.”

Gunman followed conspiracy groups

Long had at least two websites where he described himself as a “Freedom Strategist, Mental Game Coach, Nutritionist, Author and Spiritual Adviser,” according to a CNN review of the websites.

In addition, Long followed several conspiracy groups devoted to government surveillance and monitoring. CNN found that an email address linked to Long showed he was a member of a support group in an organization called Freedom from Covert Harassment and Surveillance, whose mission is to help those “Marginalized and abused by… Remote Brain experimentation, Remote Neural Monitoring of an entire Humans Body.”

Sheriff: I predicted this

The FBI is vetting the gunman’s claims he was a member of the Nation of Islam. An official said the belief is that Long identified as being associated with the black separatist movement in some capacity but there is no indication he was directed by it. The law enforcement official said the FBI has no indication any black separatist or other domestic terrorist groups are supporting or sending people to kill cops.

In the July 8 YouTube video, Long says he acted on his own and that he wasn’t directed by any group.

“I just wanted to let y’all know, don’t affiliate me with nothing,” he says. “I thought my own stuff; I made my own decisions; I’m the one who gotta listen to the judgment.”

Read the full profile of Long

Police had been on alert

Since the shooting death of Sterling by Baton Rouge police, the department has worried about threats against officers.

It has been an emotionally charged few days across the country because of the protests stemming from the Sterling shooting and the shooting by police of Philando Castile in Minnesota, plus the ambush on Dallas police officers in which a sniper killed five officers.

“This is an unspeakable and unjustified attack on all of us at a time when we need unity and healing,” Edwards said Sunday in the hours after the Baton Rouge shooting.

CNN’s Shimon Prokupecz, Evan Perez, Diane Ruggiero, Ashley Fantz, Sheena Jones, Don Lemon, Carma Hassan, Pamela Brown, Mary Lynn Ryan, Vivian Kuo and Nick Valencia contributed to this report.