Major damage was narrowly averted Friday as a fire that destroyed several buildings at the Unim factory in Mirabel was extinguished before it could spread.

The fire at 11974 Sir Wilfrid Laurier Blvd. saw high flames leap from the structures just after midnight Friday.

A Unim company official told CTV Montreal that the building was to be demolished by fire as a part of a series of firefighter training exercises on Saturday. Ten controlled fires were scheduled as part of the training.

For reasons unknown, the conflagration went off prematurely.

Firefighters came to the scene to extinguish the blaze before it spread further.

Flash Formation is the company that was conducting the training.

Company spokesperson Martin Corriveau said three of the 10 scheduled controlled fires were set the day before the building went up in flames, and all the checks were done to make sure those fires were out.

Corriveau is a career firefighter and was onsite while the controlled fires were set. He said he was “confident that everything was okay” before leaving that day.

They have asked the company for the surveillance videos to check if there were any intruders during the night.

The Mirabel fire department should be done its investigation early next week.