SEXSMITH, Alta. -- Residents in a northwestern Alberta town have been told it's safe to return home following a train derailment.

Four cars carrying anhydrous ammonia derailed Wednesday in the town of Sexsmith, near Grande Prairie, and about 470 kilometres northwest of Edmonton.

The cars remained upright and there were no leaks, but about 150 nearby homes were evacuated as a precaution.

RCMP say in a news release that people can go home but they should stay out of the derailment site.

The release says Canadian National railway is confident it has control over the ammonia in the derailed cars.

The company expects it will take a full day for workers to get the cars back on the tracks.