The suspect, dressed in black and armed with a rifle, was himself shot to death minutes later in a gunfight with police who converged on the scene of what Baton Rouge Mayor Kip Holden said began as an "ambush-style" attack on officers.
Two Baton Rouge Police Department officers and one sheriff's deputy were killed, and one sheriff's deputy was left critically wounded. Another police officer and one other deputy suffered less severe wounds and were expected to survive.
Colonel Mike Edmonson, superintendent of the Louisiana State Police, said in a press conference that the gunman was believed to have acted alone, contrary to early reports that police may have been looking for other shooters.
Authorities did not name the suspect. But a U.S. government official told Reuters the gunman had been identified as Gavin Long, of Kansas City, Missouri. He was reported by other media to have been 29 years of age and black.
The government source, speaking on condition of anonymity, also said investigators have reason to believe an emergency-911 call may have been used to lure police into harm's way.
Authorities declined to offer any possible motive for the attack.
And it was not immediately clear whether there was a link between Sunday's bloodshed and unrest over the police killings of two black men under questionable circumstances earlier this month - Alton Sterling, 37, in Baton Rouge on July 5, and Philando Castile, 32, near St. Paul, Minnesota on July 6.
President Barack Obama condemned the attack, vowed that justice would be done and called on Americans to focus on rhetoric and actions that united the country rather than divided it.
"We as a nation have to be loud and clear that nothing justifies violence on law enforcement," Obama said in televised remarks from the White House.
Louisiana Governor John Bel Edwards called the shootings an "unspeakable, heinous attack" that served no purpose.
"There simply is no place for more violence. That doesn't help anyone, it doesn't further the conversation, it doesn't address any injustice, perceived or real. It is just an injustice in and of itself," he told reporters in Baton Rouge.
Obama has sought to balance concerns about police abuses, largely against African-Americans, while paying tribute to fallen officers.
He attended a memorial service last week for the five Dallas police officers killed by a black former U.S. soldier who opened fire at the end of an otherwise peaceful protest on July 7 denouncing the Sterling and Castile slayings.
Those two killings and the reprisal attack on Dallas police by a suspect found to have embraced militant black nationalism renewed national tensions over racial justice and gun violence just as America's presidential campaign was kicking into high gear. The Dallas gunman, Micah Johnson, 25, was killed by police deploying a bomb-carrying robot against him.
The wave of violence also has heightened security concerns across the country, notably in Cleveland and Philadelphia, hosts to this week's Republican National Convention and next week's Democratic National Convention, respectively, which are expected to formally nominate Donald Trump and Hillary Clinton for the election.
WORRIES AROUND CONVENTION
"We demand law and order," Trump said in a Facebook posting Sunday afternoon.
In a statement, Clinton urged Americans to "stand together to reject violence and strengthen our communities."
The head of a Cleveland police union called on Ohio Governor John Kasich to declare a state of emergency and suspend laws allowing for the open carry of firearms during the Republican convention.
"I don't care what the legal precedent is. I feel strongly that leadership needs to stand up and defend these police officers," Steve Loomis, president of the Cleveland Police Patrolmen's Association, told Reuters in an interview.
Loomis said he was concerned about copycat shootings at the Republican convention.
A spokeswoman for Kasich said the governor did not have the power to suspend the open carry law.
Sunday's shootings occurred about a mile from the Baton Rouge Police Department headquarters, where dozens of people were arrested this month while protesting Sterling's death. The 37-year-old African-American father of five was shot and killed at close quarters by law enforcement officers.
A witness to Baton Rouge shootings, Brady Vancel, told a CBS television affiliate he had seen a gunman, a second man in a red shirt lying in a parking lot and another gunman running away "as shots were being fired back and forth from several guns."
He said the police arrived shortly after the gunfire began.
One of the injured officers was listed in critical condition at Our Lady of the Lake Regional Medical Center, while another was in fair condition, hospital spokeswoman Kelly Zimmerman said. The third was taken to another hospital where he was in fair condition.
Shocked community members lined the highway about a mile from the shootings, at the site of the protests against Sterling's killing.
"It never hits home until it's in your own living room," said Redell Norman, an activist who attended the recent protests at police headquarters.