At a July 7 march in Dallas, Texas, a black gunman killed five police and wounded several others before he was slain. The Dallas shooter, identified as Micah Xavier Johnson, an army reservist who served time in Afghanistan, said that he wanted to kill white cops.
- Troubled shooter -
The Baton Rouge shooting took place along a highway near the police headquarters around 8:40 am (1340 GMT), after officers responded to a call about a man carrying a rifle. The suspect was dressed all in black and, some reports said, wore a mask.
A witness told local media the gunman carried what appeared to be an AR-15 assault-style rifle.
The shooter, based in Kansas City -- more than 700 miles north of Baton Rouge -- was a former Marine whose served a 2008-2009 tour of duty in Iraq tour.
In 2015 Long legally changed his name to Cosmo Ausar Setepenra, claiming to be a member of the Washitaw Nation, a group of African Americans claiming to be a Native American nation in the United States.
RELATED: Are We Getting Desensitized To Shootings?
Setepenra's Twitter feed said he had traveled to Dallas after the July 7 shooting. It is also filled with posts targeting white people.
But one of the officers killed by Long -- Montrell Jackson, 32 -- was black. The other two were identified as Matthew Gerald and Brad Garafola.
"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," Jackson wrote recently on Facebook.
"Please don't let hate infect your heart. This city MUST and WILL get better ... if you see me and need a hug or want to say a prayer I got you."
- 'Cowardly' -
President Barack Obama condemned the "cowardly" Baton Rouge shooting and demanded an end to such violence.
"It is so important that everyone... right now focus on words and actions that can unite this country rather than divide it further," Obama told reporters at the White House.
"We don't need inflammatory rhetoric. We don't need careless accusations thrown around to score political points or to advance an agenda. We need to temper our words and open our hearts, all of us."
Obama, the first black US president, has repeatedly called for racial unity. "Nothing justifies violence against law enforcement," he said.
RELATED: Cleveland Buying $20 Mln in Riot Gear for GOP Convention
Donald Trump, the presumptive Republican presidential nominee, expressed grief in a Facebook post.
"How many law enforcement and people have to die because of a lack of leadership in our country? We demand law and order," he wrote.
Presumptive Democratic presidential candidate Hillary Clinton said the shooting is an assault on everyone. "We must stand together to reject violence and strengthen our communities," she said.
Sterling's aunt Veda Washington-Abusaleh made a tearful plea for an end to the violence.
"We don't want no more bloodshed. Leave. Go home. Go wherever you come from. This is our house. You can't come in our house killing us," she said in an emotional interview with local television.
"No justice! No peace! That's what we're calling for. Stop this killing!"
Louisiana Governor John Bel Edwards described the shooting as "an absolutely unspeakable, heinous attack on law enforcement here in Baton Rouge."
He added: "The violence, the hatred, just has to stop."
Last week, police arrested more than 100 protesters taking part in a demonstration against police brutality in Baton Rouge under the banner of the Black Lives Matter movement.