A suspect shot dead at the scene was thought to be the only gunman involved, police said. Reports earlier suggested there was more than one gunman.
President Barack Obama said nothing justified attacks on police officers.
It is not clear what the motive is, or whether there is any link to the killing by police of a black man in the city nearly two weeks ago.
The shooting of Alton Sterling and another killing of a black man in Minnesota, led to widespread protests across the US.