From marshes and swamps to an apartment in Brooklyn: A 41-year-old man was arrested for having an alligator-like predator in his apartment, along with facing drug and weapons charges, police said on Thursday.

Cops found the caiman (a reptile that looks like a small alligator) inside Habakkuk Tracey’s Flatbush-Ditmas Park home on Wednesday morning, where he was allegedly keeping the reptile in a tank in the living room.

advertisement | advertise on newsday

Police were executing a search warrant at the time, and recovered crack cocaine in the East 21st Street apartment as well. Tracey allegedly dropped a .380 semi-automatic handgun out of the bedroom window, which cops recovered, a police source said.

Tracey, who is no stranger to being arrested, was charged with criminal possession of a controlled substance, criminal possession of a loaded firearm and having a prohibited wild animal, which is a health code violation. He has 30 prior arrests in the city, the source said.

The caiman was taken to Animal Care Centers of NYC, police said.

Tracey was awaiting arraignment on Thursday.