CNN  — 

The man who took two hostages Monday at a UPS facility in Logan Township was shot and killed by police after the three emerged from the building, the office of New Jersey’s attorney general said.

“There was apparently a relationship between the man and one of the women,” Gloucester County prosecutor Charles Fiore said, adding that it was a “prior relationship.”

Earlier, authorities said the man killed by police, identified as William Owens, 39, of Sicklerville, New Jersey, had been hospitalized. “According to the preliminary investigation, the shooting occurred after the gunman and hostages had exited the building,” the attorney general’s office said. The man was armed with a handgun.

Neither of the women held hostage was seriously harmed, Fiore said. Both were UPS employees.

The armed man did not surrender to police, he said, explaining, “There was an intervention.” He did not elaborate.

Hours earlier, Fiore told reporters that police were speaking via telephone with the hostage taker, who had barricaded himself and the two women in a room at the UPS facility. Shots had been fired, he said at the time, but there were no reports of injuries.

Thirty-two UPS employees were evacuated to a Holiday Inn about 10 minutes away, Gloucester County spokeswoman Debra Sellitto said.

The incident was confined to the UPS building, she said. The county received word of an active shooter situation around 8:30 a.m. ET. The building, in an industrial district of the south New Jersey township of 6,000, is a bulk mail processing facility, UPS said.

“The incident is concluded and all of the employees are accounted for and being attended to by local officials. Support services for employees who work at the site will be provided as they recover from this unfortunate incident,” UPS said.

The township’s school district was placed under modified lockdown, and no one was allowed to enter or leave any of its schools after police notified the district of “police activity in a nearby industrial park,” Superintendent Patricia Haney said.

CNN’s Kristina Sgueglia and Aaron Cooper contributed to this report.