Bart Jansen

USA TODAY

Three police officers were fatally shot in Baton Rouge and three others were wounded, according to officials, in what one witness described as a fusillade of dozens of shots shattering the calm of a Sunday morning.

President Obama condemned the attack, which came just 10 days after a gunman killed five police officers in Dallas — and 12 days after police in Baton Rouge fatally shot 37-year-old Alton Sterling while he was pinned to the ground. Police have said the officers, who were white, thought Sterling, who was black, was reaching for a gun in the July 5 shooting. Sterling’s funeral was Friday.

Speaking from the White House, Obama said there was no justification for Sunday's "cowardly and reprehensible" violence against law enforcement. “Regardless of motive, the death of these three brave officers underscores the danger that police across the country confront every single day," Obama said.

The gunman, who was African-American, was killed at the scene, police said. But no motivation for the shootings was immediately revealed. A law enforcement official identified the gunman as Gavin E. Long, 29. The official, who is not authorized to comment publicly, said Long is from the Kansas City area and did not appear to have family links to Baton Rouge.

Authorities recovered a rifle and a handgun that Long is believed to have used in the attack. Investigators were looking at Long's possible links to black separatist groups.

The official said authorities believe that Long acted alone, despite initial reports from local law enforcement that as many as two others were being sought. The Pentagon late Sunday said Long was a decorated Marine who served in Iraq from June 2008 to January 2009 as a data network specialist. He was discharged in 2010.

It was immediately unclear what precipitated the attack, though the official said investigators were reviewing 911 calls to determine whether the officers were lured to the location of the shooting.

Long turned 29 on Sunday, according to public records. Missouri court records show Long filed for divorce from his wife on Valentine's Day, 2011 in a Kansas City court and that the divorce was finalized on May 24, 2011. The couple apparently had no children.

Louisiana Gov. John Bel Edwards earlier suggested the attack may have involved more than one assailant, but Col. Michael Edmonson, superintendent of state police, told reporters, “We do believe that the person that shot and killed our officers — that he is the person who was shot and killed at the scene."

One of the slain officers was identified as 32-year-old Montrell Jackson, a 10-year-veteran of the Baton Rouge Police Department. The second victim was identified as Matthew Gerald, 41.

The third slain officer was identified as 45-year-old East Baton Rouge sheriff's deputy Brad Garafola. He was a 24-year veteran of the sheriff's department, said Sheriff Sid Gautreaux III.

Nicholas Tullier, a 41-year-old sheriff's deputy, was in critical condition after surgery, said Gautreaux. A third deputy, Bruce Simmons, 51, suffered non-life-threatening injuries, he said.

A 41-year-old city officer also suffered non-life-threatening injuries.

“We will continue to do our job in light of what’s happening," Baton Rouge Police Chief Carl Dabadie said at the news conference. "This is not going to tarnish this city or this department. We’re going to move forward."

Two “persons of interest” have been detained near Baton Rouge, a police spokesman told the Associated Press.

Authorities were continuing to investigate the shootings that began about 8:40 a.m. less than a mile from police headquarters, in the area of Airline Highway and Old Hammond Highway.

“It’s an ongoing investigation with a lot of moving parts," Edmonson said.

Kelly Zimmerman of Our Lady of the Lake said the hospital received five patients. Three were dead, one is in critical condition and the other is in fair condition, Zimmerman said.

Condolences pour in for Baton Rouge slain officers

Baton Rouge police shooting: What we know

Obama urged politicians to temper their rhetoric and focus on unity as the Republican and Democratic conventions loomed.

"We don’t need inflammatory rhetoric," Obama said. “Someone once wrote: a bullet need happen only once, but for peace to work we have to be reminded of its existence again and again and again."

Edwards called the attack "unspeakable" and "unjustified."

“The violence, the hatred just has to stop," Edwards said at his news conference flanked by law-enforcement officials.

Brady Vancel, 22, of Denham Springs, was working a flooring job at a home near the shooting scene when he heard dozens of popping sounds.

"I didn't think it was gunshots, because there was no pattern or anything," he said. "But after about the 28th pop, I wanted to check it out."

Vancel walked outside the home and went toward a Party City store when he saw a man lying still in an empty parking lot. He couldn't tell if the man, who was wearing civilian clothes, was injured or staying out of the way of gunfire.

About 40 yards away, Vancel said he saw a man running toward him carrying a rifle. Police were not on the scene yet, Vancel said, but sirens could be heard approaching the area.

The man was wearing all black and had a black mask over his face, like a ski mask, Vancel said. The man stopped and looked toward Vancel before running the opposite way toward Airline Highway. Vancel said he also turned and ran back to the house where he was working.

"The only thing my eyes kind of locked on was the rifle he was carrying," said Vancel, who couldn't determine the race of the gunman.

From inside the home, Vancel said he heard dozens more gunshots.

Avery Hall, a 17-year-old worker at Benny’s Carwash directly behind the B-Quik convenience store on Airline Highway where the shooting began, said he was about to pull into work at about 8:45 a.m. when he was “caught in the crossfire.”

“I thought it was a protest, that’s why I thought we could go around,” said Hall, a recent graduate from a Baton Rouge high school.

Gunshots continued as police ducked and aimed toward the fire. Hall scrambled to the Salbury’s Chrysler Dodge and hid behind his car.

Police told Hall and a coworker who was with him to take cover in the dealership, but the doors were locked. So they went to the Hammond Aire Auto Spa, which is directly across the highway from the shooting scene, where they stayed for hours with about 20 other people until police allowed them to leave.

A recording of police-scanner traffic on Broadcastify.com offered a glimpse of the confusion about the number of shooters and where they were located when the incident began.

“Supposedly a lady came up and said there was a subject walking with a coat and an assault rifle out here behind the store,” an officer tells dispatchers before another officer interrupts.

“Shots fired, officer down! Shots fired, officer down!”

“Got a city officer down. Shots fired.”

Officers relayed that they weren’t sure where shots were originating.

“Don’t know where the subject’s shooting from.”

Moments later, the dispatcher reports that a gunman is near a car wash and still shooting.

“I’m hit,” an officer said. “Left arm.”

Baton Route police Cpl. L'Jean Mckneely said after the suspect was shot that police sent a robot in, “making sure there aren’t any explosives in the area."

"There was no talking. There was shooting,” he said.

Alton Sterling: Killed by police, forgotten by the media?

U.S. Sen. Bill Cassidy, R-La., tweeted condolences for the victims and said that senseless violence must end.

Sterling's mother, Quinetta McMillon, said in a statement that her family were "disgusted by the despicable act of violence today that resulted in the shooting deaths of members of the Baton Rouge law enforcement," adding, "all we want is peace. We reject violence of any kind directed at members of law enforcement or citizens."

The shooting may already be affecting policing in nearby New Orleans, where Police Chief Michael Harrison said Sunday that officers will only respond to calls in pairs, WWL-TV reported.

And in Milwaukee, police on Sunday said they would use two-person squads "until further notice," after officer Brandon Baranowski was wounded early Sunday morning as he sat in his squad car. Police said the 20-year-old suspect was later found dead of a suspected self-inflicted gunshot wound, the Milwaukee Journal Sentinel reported.

Contributing: Chris Woodyard, Ryan Miller, Jack Richards, Brett Blackledge and Greg Toppo.​