Authorities said Monday that they believe the gunman who opened fire in Baton Rouge a day earlier, killing three police officers and injuring three others before dying in a shootout with police, was looking for law enforcement and ambushed the officers.

“We do believe he was targeting officers, and he definitely did ambush these officers that he shot,” Lt. J.B. Slaton, a Louisiana State Police spokesman, said Monday morning.

Slaton said that it was still early in the investigation, which the state police are leading, and added that authorities were still trying to figure out what motivated the attacker.

Police identified the gunman as Gavin Long, a black man and Marine who had posted videos online seemingly endorsing violence as a way to push back against law enforcement.