A 20-year-old man charged with shooting two police officers watching over a protest outside the Ferguson Police Department has told investigators he was not targeting the officers.

St Louis County prosecutor Robert McCulloch said Jeffrey Williams told authorities he was firing at someone with whom he was in a dispute.

"We're not sure we completely buy that part of it," Mr McCulloch said, adding that there might have been other people in the vehicle with Mr Williams.

Mr Williams is charged with two counts of first-degree assault, one count of firing a weapon from a vehicle and three counts of armed criminal action. Mr McCulloch said the investigation is ongoing.

Tensions between police and the black community have been high in Ferguson since the fatal August 9 shooting of 18-year-old Michael Brown, who was black and unarmed, by now-former police officer Darren Wilson, who is white. Mr Wilson was cleared by a Justice Department report, and a grand jury declined to indict him in November.

The incident sparked a nationwide discussion about police relations with minority communities.

The two officers were shot early on Thursday as a crowd began to break up after a late-night demonstration that unfolded after Ferguson police chief Tom Jackson resigned in the wake of the scathing Justice Department report.

The federal report found widespread racial bias in the city's policing and in a municipal court system driven by profit extracted from mostly black and low-income residents. Six Ferguson officials, including Mr Jackson, have resigned or been fired since the report was released March 4.