Several dozen protesters had gathered in front of the Ferguson police department on Wednesday night, just hours after the city's police chief, Thomas Jackson, announced his resignation.
The demonstration started peacefully, but about two dozen officers clad in riot gear later faced off with the protesters. At least two people were taken into custody.
Around midnight, gunshots rang out, turning a scene of relative quiet into pandemonium. Many of the remaining few dozen demonstrators fled, some screaming, "They hit a cop," a Reuters photographer said.
The line of police scrambled, with many taking defensive positions drawing their weapons and some huddling behind riot shields, according to a video published online.
Belmar said the shooter was "embedded" among the demonstrators standing across from the officers.
Read MoreMissouri teen fatally shot by police near Ferguson
"I don't know who did the shooting to be honest with you right now, but somehow they were embedded in that group of folks," he said.
Protesters at the scene however said on social media that the shots did not come from where they were standing.
"The shooter was not with the protesters. The shooter was atop the hill," activist DeRay McKesson said on Twitter.
"I was here. I saw the officer fall. The shot came from at least 500 feet away from the officers," he added.
Protesters had called for Jackson's removal since the fatal shooting of unarmed black 18-year-old Michael Brown by white Ferguson police officer Darren Wilson in August.
The killing triggered protests around the country and drew scrutiny to police use of deadly force, especially against black men.
Neither a grand jury nor the federal probe led to charges against Wilson.
Jackson was the latest in a string of Ferguson officials to resign in the week since a scathing Justice Department report found widespread racially biased abuses in the city's policing and municipal court.