A former Marine dressed in black and carrying extra ammunition shot and killed three Baton Rouge law enforcement officers, less than two weeks after a black man was fatally shot by police there in a confrontation that sparked nightly protests that reverberated nationwide.
Three other officers were wounded Sunday, one critically. Police said the gunman was killed at the scene.
The shooting less than a mile from police headquarters added to the tensions across the country between the black community and police. Just days earlier, one of the slain officers had posted an emotional Facebook message about the challenges of police work in the current environment.
President Barack Obama urged Americans to tamp down inflammatory words and actions.
"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 said.
The gunman was identified as Gavin Long of Kansas City, who turned 29 on Sunday.
Long, who was black, served in the Marines from 2005 to 2010, reaching the rank of sergeant. He deployed to Iraq from June 2008 to January 2009, according to military records.
Although he was believed to be the only person who fired at officers, authorities were investigating whether he had some kind of help.
"We are not ready to say he acted alone," state police spokesman Major Doug Cain said. Two "persons of interest" were detained for questioning in the nearby town of Addis. They were later released without any charges being filed.
While in the military, Long was awarded several medals, including one for good conduct, and received an honorable discharge. His occupational expertise was listed as "data network specialist."
The University of Alabama issued a statement saying Long attended classes for one semester in the spring of 2012. A school spokesman said university police had no interactions with him.
In Kansas City, police officers, some with guns drawn, converged on a house listed as Long's.
It was the fourth high-profile deadly encounter in the United States involving police over the past two weeks. In all, the violence has cost the lives of eight officers, including those in Baton Rouge, and two civilians and sparked a national debate over race and policing.
Authorities initially believed that additional assailants might be at large, but hours later said there were no other active shooters. They did not discuss the gunman's motive or any relationship to the wider police conflicts.
The shooting began at a gas station on Airline Highway. According to radio traffic, Baton Rouge police answered a report of a man with an assault rifle and were met by gunfire. For several long minutes, they did not know where it was coming from.
The radio exchanges were made public Sunday by the website Broadcastify.
Nearly 2½ minutes after the first report of an officer getting shot, an officer on the scene is heard saying police do not know the shooter's location.
Almost 6 minutes pass after the first shots are reported before police say they have determined the shooter's location. About 30 seconds later, someone says shots are still being fired.
The recording lasts about 17 minutes and includes urgent calls for an armored personnel carrier called a BearCat.
"There simply is no place for more violence," Louisiana Gov. John Bel Edwards said. "It doesn't further the conversation. It doesn't address any injustice perceived or real. It is just an injustice in and of itself."
From his window, Joshua Godwin said he saw the suspect, who was dressed in black with a ski mask, combat boots, and extra bullets. He appeared to be running "from an altercation."
Mike Spring awoke at a nearby house to a sound that he thought was from firecrackers. The noise went on for 5 to 10 minutes, getting louder.
Of the two officers who survived the shooting, one was hospitalized in critical condition, and the other was in fair condition. Another officer was being treated for non-life-threatening injuries, hospital officials said.
Two of the slain officers were from the Baton Rouge Police Department: 32-year-old Montrell Jackson, who had been on the force for a decade, and 41-year-old Matthew Gerald, who had been there for less than a year.
The third fatality was Brad Garafola, 45 and a 24-year veteran of the East Baton Rouge Sheriff's Office.
Jackson, who was black, posted his message on Facebook on July 8, just three days after the death of 37-year-old Alton Sterling, a black man killed by white Baton Rouge officers after a scuffle at a convenience store.
In the message, Jackson said he was physically and emotionally tired and complained that while in uniform, he gets nasty looks. When he's out of uniform, he said, some people consider him a threat.
A friend of Jackson's family, Erika Green, confirmed the posting, which is no longer on Facebook. A screenshot of the image was circulating widely on the internet.
Police-community relations in Baton Rouge have been especially tense since Sterling's death. The killing was captured on cellphone video.
It was followed a day later by the shooting death of another black man in Minnesota, whose girlfriend livestreamed the aftermath of his death on Facebook. The next day, a black gunman in Dallas opened fire on police at a protest about the police shootings, killing five officers and heightening tensions even further.
Thousands of people protested Sterling's death, and Baton Rouge police arrested more than 200 demonstrators.
Sterling's nephew condemned the killing of the three Baton Rouge officers. Terrance Carter spoke Sunday to The Associated Press by telephone, saying the family just wants peace.
"My uncle wouldn't want this," Carter said. "He wasn't this type of man."
A few yards from a police roadblock on Airline Highway, Keimani Gardner was in the parking lot of a warehouse store that would ordinarily be bustling on a Sunday afternoon. He and his girlfriend both work there. But the store was closed because of the shooting.
"It's crazy. ... I understand some people feel like enough is enough with, you know, the black community being shot," said Gardner, an African-American. "But honestly, you can't solve violence with violence."
Michelle Rogers and her husband drove near the shooting scene, but were blocked at an intersection closed by police.
"I can't explain what brought us here," she said. "We just said a prayer in the car for the families."
Also Sunday, a domestic violence suspect opened fire on a Milwaukee police officer who was sitting in his squad car. The officer was seriously wounded, and the suspect fled and apparently killed himself, authorities said.
Associated Press writers Eric Tucker in Washington, Rebecca Santana and Janet McConnaughey in New Orleans, Maria Sudekum in Kansas City and Kevin McGill, Cain Burdeau and Gerald Herbert in Baton Rouge contributed to this report.