All residents of Takaka in Golden Bay were evacuated last night when a blaze that engulfed the Fonterra milk factory threatened to ignite chemicals and produce deadly mustard gas.
Police asked 2000 people within 500m of the factory to leave their homes as a precaution after the blaze broke out just after 5pm.
They were allowed to return late last night.
Takaka is 120km north-west of Nelson, on the edge of the Abel Tasman National Park.
A dozen fire engines were deployed to contain the blaze. More than two hours later, firefighters were still battling to get the fire under control.
The focus was on keeping the fire away from the silos of caustic soda and sulphuric acid, said Nelson fire senior station officer Rob Allan.
"If they do combine under a fire situation the gas that's produced is mustard gas," he said.
Taxi operator Lindsay Hill said he was not evacuated as he lives 2km from the factory, but several evacuees living closer to the factory had sought shelter in his home.
Mr Hill said other evacuees had been asked to gather at Takaka Primary School, 1km from the factory, and others were sent to Motupipi School, about 5km from Takaka.
"It [the factory] is the biggest employer in Golden Bay and it's just going up in smoke, so there's not going to be a lot of happy people around. We used to have the cement company, now closed down."