NEW YORK (Reuters) - Two New York City police officers who were first said to have been shot at while on foot patrol were not targeted in the shooting, police said on Wednesday.

The uniformed officers were patrolling in the Ditmas Park section in the borough of Brooklyn just before 11 p.m. EDT on Tuesday when multiple shots were fired near them by individuals who drove past in a sedan, a police department spokesman said.

Neither of the officers was injured.

Shortly after the shooting, the Sergeants Benevolent Association said on the union's Facebook page that the shooters approached the officers in the vehicle and made a statement "about getting them" before shots were fired.

The statement was issued prematurely, the NYPD spokesman said, and further investigation indicated that the officers were not targeted in the shooting. The shots were likely aimed at nearby rivals, he said.

It was not immediately known if there were any arrests.

The incident came two days after three police officers were gunned down in Baton Rouge, Louisiana, and less than two weeks after five Dallas police officers were killed by a gunman. Both shootings are believed to have been racially motivated attacks by black men aimed at white officers.

(Reporting by Brendan O'Brien in Milwaukee and Laila Kearney in New York; Editing by Michael Perry and Jeffrey Benkoe)