A man was killed when he came into contact with the third rail while crossing the subway tracks in Manhattan on Sunday morning and was then struck by a train, cops said.

The 31-year-old was walking across the No. 6 subway tracks at Lexington Avenue and East 51st Street around 8:30 a.m. when he touched the electrified rail, police said.

The southbound train then pulled in and hit him.

It wasn’t clear why he was walking across the tracks, cops said.