Firefighters say they knocked down a large, stubborn blaze at an Etobicoke bakery that burned for nearly three hours on Tuesday night, compromising the building’s structure and prompting the shutdown of a nearby rail line.

Toronto firefighters say they were called to Del’s Pastry on Bering Avenue, near Kipling Avenue and Bloor Street West, at 9:47 p.m. for a fire that broke out.

It reached five alarms several hours later, with crews having to retreat away from the walls of the building for fears they might collapse.

High winds helped fan flames and continue the fire’s spread.

City workers cut power to the building, and Canadian Pacific Rail had to halt traffic on a nearby rail line because of the fire.

They were able to knock down the flames by about 12:25 a.m. Wednesday and a fire investigator is now working to determine what sparked the blaze.

It is believed the fire started in one of the bakery’s ovens.

Crews remain on scene to deal with any hotspots or flare-ups.

Officials said the majority of the structure was brought down by the fire.