PASSAIC, N.J. (AP) — A dramatic fire near a chemical plant burned through the night and into Saturday in northern New Jersey but led to no evacuation orders or serious injuries — just heavy smoke that was seen and smelled in nearby New York City.

The fire at Majestic Industries and the Qualco chemical plant in Passaic was in buildings housing plastics, pallets and chlorine, officials said, but catastrophe was averted.

Crews battled pockets of the blaze into the morning, Passaic Mayor Hector Lora said, but it was contained.

The fire was prevented from reaching the main chemical plant, which could have endangered the densely populated New York City suburbs of New Jersey, Lora said.

Lora on Sunday thanked the firefighters in a Facebook post. “Together you prevented a terrible situation from becoming disastrous.”

Nearby residents were advised to close their windows but were not required to evacuate, with officials saying air quality remained acceptable and would be monitored.

Some residents fled nonetheless.

Frigid weather froze water from hydrants and hoses, hampering boats trying to draw water from the Passaic River and causing firefighters to slip and fall, Lora said. One firefighter went to the hospital with an eye injury, he said.