A Hempstead man who tried to shoot someone he knew and almost struck a police officer with his car in Uniondale was arrested early Saturday afternoon, Nassau County police said.

Melvin Valencia, 27, driving a 2015 Honda Accord, followed the victim in another vehicle about an hour before dawn, police said in a news release. The victim stopped and got out of his vehicle on Clinton Avenue, police said.

Approaching the victim, Valencia displayed a handgun — and fired several times — before driving away about 4:18 a.m., police said.

The victim, whom the police did not name, was not injured, police said.

advertisement | advertise on newsday

The police who responded spotted Valencia’s Honda, stopped him and questioned him, police said.

Valencia ran back to his car and fled again, almost hitting one of the officers, police said.

The defendant, who is being charged with assault, criminal use of a firearm and reckless endangerment, is scheduled to be arraigned on Sunday, police said.