The huge fireworks blast that rattled The Bronx, terrifying residents and even breaking nearby windows (right) was set off by punks celebrating the release of Lillo Brancato (left) from prison, sources say. Photo: Dennis A. Clark

The fireworks explosion that rocked The Bronx last week was set off by local punks celebrating “Sopranos” actor Lillo Brancato’s release from prison, police sources told The Post.

The blast shook homes and broke windows in Pelham Bay around 11 p.m. on Dec. 30, just hours before Brancato was sprung. He served eight years for a 2005 burglary that ended in the murder of NYPD Detective Daniel Enchautegui.

The amateur pyrotechs exploded commercial-grade fireworks on a baseball diamond in the park adjacent to Middletown Road and Ampere Avenue — just five blocks from where Enchautegui was killed.

The blast shattered windows in at least four nearby homes and left a crater in the ground.

Residents ducked for cover as glass shards sprayed into their living rooms. There were a flood of 911 calls.

The NYPD Bomb Squad found several spent pyrotechnic shells inside a garbage pail. Nearby was one unspent four-inch shell and several pieces of the fireworks packaging.

“We’re looking at the young guys in the neighborhood, the Mafia wannabe types,” a law enforcement source said.