A would-be hitman from Westbury who authorities say was paid $500 to kill a man involved in a love triangle but had a last-minute “change of heart” was arraigned on felony charges Tuesday.

Herberth Hernandez, 40, and the man accused of hiring him, Hamen Gonzales-Cruz, 35, also of Westbury, appeared in First District Court in Hempstead.

Brandishing a handgun, Hernandez confronted the intended victim in Westbury in front of Uptown Restaurant Grill on Prospect Avenue at about 3:15 p.m. Monday, police said.

But “Hernandez had a change of heart and was unable to shoot the 30-year-old,” police said in a release.

“Hernandez fired one shot into the ground and a second shot into the air, neither of which injured the victim,” said Nassau Det. Vincent Garcia, a police spokesman.

A person who heard the shots called 911, and Hernandez and Gonzales-Cruz were arrested Monday afternoon near the scene, police said.

advertisement | advertise on newsday

Officers found Gonzales-Cruz and Hernandez behind an adjacent building, and saw Hernandez drop the gun, police said.

Gonzales-Cruz was charged with conspiracy and criminal facilitation, and Hernandez was charged with conspiracy, criminal possession of a firearm, reckless endangerment and menacing, police said.

Police said Gonzales-Cruz wanted the intended victim “out of the picture” because he was having a relationship with Gonzales-Cruz’s girlfriend.

Gonzales-Cruz hired Hernandez and gave him a handgun to carry out the murder, police said.

Hernandez was held Tuesday on $400,000 bond or $250,000 cash, according to court records. A temporary order of protection was also issued. Gonzales-Cruz was held on $220,000 bail or $150,000 bond.

Attorneys for both men could not be reached for comment.