EAST NEW YORK - Two men were taken into custody in connection with the shooting of an off-duty NYPD police officer in Brooklyn.

Police took both men, who were riding in a BMW, into custody Wednesday night in Oceanside, located on Long Island. Both men are from Brooklyn and it is not clear why they were on Long Island.

Housing Officer Tramaine Oxley was shot during an attempted robbery in the East New York section of Brooklyn Tuesday night, authorities say. Police believe the shooting suspects did not know Oxley was an officer.

Detectives say at least one of the suspects was linked to the crime after a fingerprint matched one fond at the scene of the shooting.

Oxley is recovering from gunshot wounds to the arm and chest.