Two chemical leaks at a shampoo factory sent a toxic cloud over two towns Friday, forcing 1,700 people from their homes and injuring 23 people before the gas dissipated, officials said.

"The emergency is contained and everything is under control," said John Everett, an aide to Nashua Mayor James Donchess, about nine hours after the noxious vapors from the W.R. Grace Co. plant drifted over Nashua and Hudson.Emergency crews had nearly contained the initial leak by late morning when a second leak sent more of the gas into the air, said John Gifford, a spokesman for the Governor's Office of Emergency Management.

"They were able to knock down the material almost immediately," Gifford said of the second leak. No additional evacuations were prompted by the second release.