Four teenagers have been arrested for their role in a fire that burned an old mill to the ground. 

Haverhill firefighters battled a massive blaze at an abandoned mill, which grew to a 7-alarm fire on Sunday evening. It took all night for firefighters to put the flames down, and the building was beyond saving. 

The four juveniles, aged 14, 15, 15 and 16 are being charged with burning of a building and will be arraigned in Lawrence Juvenile Court.

“This case has come to a swift and successful conclusion because of good old-fashioned police work among a number of agencies and importantly, assistance from the community,” State Fire Marshal Stephen D. Coan said in a statement.

RELATED: Former undertaker pleads guilty to storing 12 bodies in storage unit, ripping off the bereaved

“Fighting fires in these vacant mills are extremely dangerous. Without sprinklers to control these fires, they get a huge head start and are fueled by oils that have soaked into the floorboards for decades," Interim Haverhill Fire Chief Parow said in a statement. 

“The Haverhill Police Department is very grateful and proud of the dedicated men and women from the various law enforcement and fire agencies that acted as a cohesive team in solving this complex case," Haverhill Police Detective Captain Robert Pistone said. 

RELATED: Brookline millionaire charged in 2013 arson plot

The fire was investigated by members of the Haverhill Fire and Police Departments, State Police assigned to the Office of the State Fire Marshal and the ATF.

A state Hazardous Material team responded to monitor air quality and water run-off from suppression efforts.