It was a Fourth of July miracle when a hero cop managed to gun down a knife-wielding psychopath beside a busy train station who had just stabbed him in the eye.

Brave New York MTA Officer John Barnett, who has served as a Lieutenant Commander with the Navy Reserve in Afghanistan and Iraq, shot dead crazed maniac Edgar Owens at the Long Island Rail Road station in Jamaica, Queens.

Officer Barnett, 45, was on duty and in his uniform when Owens plunged the illegal gravity knife into Barnett’s left eye at 9.30am as the officer was talking to a cab dispatcher.

With blood gushing from his eye, Barnett jumped back, drew his gun and shouted at Owens, “Police! Don’t move!”

The monster ignored Barnett’s request and lunged at him again with the knife.

Barnett, a former officer with the New York Police Department, had no option but to shoot 46-year-old Owens four times, killing him. It was the first time ice-cool Barnett had ever fired his gun on duty before.

Doctors at nearby Jamaica Hospital spent five hours battling to save Officer Barnett’s sight. They are not yet certain whether the officer, who has 12-year-old son, will be able to see through his left eye properly again.

After calling up Barnett to congratulate him, New York Governor Andrew Cuomo told reporters: “Today we are reminded once again of the bravery and sacrifice of our men and women in law enforcement and the many dangers that accompany the important job of keeping our state’s residents safe.”

Owens had a history of attacking cops. In 2006 he was arrested for punching an officer at Manhattan’s 26th Precinct.