The man who set off a deadly chain of events that left NYPD Officer Brian Mulkeen dead was more than comfortable on the wrong side of the law, sources said.

Antonio Lavance Williams, a 27-year-old convicted felon and reputed gangbanger, had at least three prior arrests across the Empire State — and was on probation for a 2018 drug bust — when he and Mulkeen were killed during a struggle over the cop’s service weapon Sunday, according to police sources.

He first ran afoul of the law in 2011 with a burglary rap in Rockland County’s Haverstraw, sources said. Williams was convicted in the case, and public records show he was sentenced to up to 42 months behind bars.

He was paroled in 2015, but it didn’t take long for Williams to fall back into his old habits.

Last year, Williams was pinched on a drug charge in upstate Endicott, landing him on probation that wasn’t set to expire until 2022, according to law enforcement sources.

But just last month, he caught a harassment case in Binghamton for which he had a court date later this week, sources said.

Williams had an open warrant on another drug possession case out of Hudson when Mulkeen was killed, sources added.

Mulkeen and two fellow cops were on patrol in the Bronx’s Edenwald Houses amid violent infighting between two factions of the Bloods when they set eyes on Williams on Sunday, sources said.

Williams, a .32-caliber revolver in his hand, took off running, setting off the deadly pursuit, sources said. Mulkeen tackled and disarmed Williams, who in turn launched a struggle for the cop’s service Glock that ended with both men fatally shot, police and sources said.

Williams was pronounced dead at the scene, according to authorities.

Additional reporting by Larry Celona