ROCKLAND, Maine — A boiler room fire on Wednesday caused an elementary school to be evacuated, but it was put out by a construction worker before firefighters arrived.

Rockland Fire Chief Chris Whytock said the situation at the South School on Broadway could have been much worse and it was fortunate no one was injured.

Workers were removing discontinued piping that had been used for fueling the boiler when the fire broke out shortly after 8 a.m., according to the chief. One of the pipes had residual propane still inside it, and when workers began to cut the pipe with a cutting torch, the propane flashed inside the boiler room.

The propane fire also ignited a plastic bucket being used to collect a small amount of waste oil and set off the building’s fire alarm. The workers initially left the boiler room, but one went back in and used a fire extinguisher to knock down the flames before firefighters arrived.

It isn’t clear how many people were in the building, but all were evacuated when the alarm went off, Whytock said. Everyone was allowed to go back in after firefighters determined there was no longer any danger.