A person accused of trying to rob passengers on the subway died after falling between cars and getting electrocuted by the third rail early Tuesday morning in the Bronx, the NYPD said.

Police say the person was fleeing officers when he jumped between train cars and slipped. He was pinned beneath the train, and as he tried to remove himself, he made contact with the third rail and died, according to authorities.

The NYPD says the person was one of four males who attempted to rob passengers on a northbound 2 train near 174th Street​ just after 5:30 a.m. Three of them — aged 16, 17 and 18 — were taken into custody when they tried to flee to a 5 train, including one person who was shot with a Taser by an officer and treated at St. Barnabas after allegedly attempting to resist arrest, police said.

The person who died has not been identified as of Tuesday evening.

A police officer sustained a knee injury during the arrest and was taken to a local hospital, authorities said.