A decorated ex-U.S. Marine sergeant opened fire on police in Baton Rouge, killing three officers, just two weeks after the fatal police shooting of a black man which sparked nationwide protests.

The Baton Rouge suspect, dressed in black and armed with a rifle, was also shot to death minutes later in a gunfight with police who converged on the scene of a confrontation that 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, while one sheriff’s deputy was 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, told a news conference that  the gunman was believed to have acted alone, contrary to early reports that police may have been looking for other shooters.

The bloodshed followed days of 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.

Police did not name the suspect. But a U.S. government official told reporters that the gunman was identified as Gavin Long, of Kansas City, Missouri. Long, who was black, was reported by other media to be 29 years old.