The off-duty federal agent who was shot dead Sunday after confronting a pharmacy robber is believed to have been fatally shot by a responding Nassau County police officer who apparently mistook him as the robber, The New York Post reported, citing an unnamed source.

John Capano was buying his father cancer medication and had chased down the suspect inside the store and was trying to subdue him on the ground when he died, said Rep. Peter King, R-N.Y.

The robber, who was also shot to death, was identified Sunday by police as 43-year-old James McGoey of Hampton Bays.

"John was with him on the ground wrestling," said King, who has spoken with local authorities and Capano's family. "Next thing you know, shots are fired."

McGoey went into Charlie's Family Pharmacy in Seaford, a small shorefront Long Island town, at about 2 p.m. on New Year's Eve, police said. He announced a holdup and was given what he came for: painkillers and money.

Capano, a trained explosives expert who had served in Iraq and Afghanistan, confronted McGoey as he tried to leave the store. Meanwhile, an off-duty NYPD officer and a retired Nassau County police officer who happened to be at a deli next door were alerted that someone was trying to rob the pharmacy, King said.

"This is a horrible confluence of events," King said. "They both hear this guy saying there's a robbery going on. They get their guns, they go next door."

Capano lived in nearby Massapequa and was married with two children. His father, Jimmy Capano, was a retired NYPD detective and the "unofficial mayor" of Merrick Road, the main thoroughfare in town and the street where his son was killed, King said.

The Associated Press contributed to this report.