A 26-year-old man was in a car with two officers before he was shot. At least one of the officers returned fire, police said.