Emergency crews in upstate New York on Thursday morning freed all 17 workers who had been trapped in an elevator at a salt mine about 800 feet below ground.

"Extremely relieved and happy to say that they're out," Cargill mine manager Shawn Wilczynski said during a news conference.

Wilczynski said the men were cold but weren't injured and were in good spirits when a crane freed them. The names of the men were not immediately released.

"I'm inspired by them, to be quite honest with you," Wilczynski added. "The first four that came out of the mine waited for the last two that came out of the mine, and they all wanted to thank the crane company."

The Cargill mine in Lansing is the deepest salt mine in the Western hemisphere, extending 2,300 feet below ground.

The Lansing Fire Department, along with the Cargill Mine staff, had been working since about 10:20 p.m. local time Wednesday to free the trapped workers. The miners were stuck in an elevator in an access shaft, according to the Ithaca Fire Department, which was also assisting officials in the rescue operation.

Wilczynski said the cause of the elevator malfunction was mechanical, but otherwise officials weren't sure why the failure occurred. The plan is to lift the elevator out of the shaft for inspection, however, there is no timetable set for that process.

"This is not an incident that we want to look at lightly," he said. "There could be further repercussions down the road."

The first four miners rescued were raised to the surface in a basket around 7 a.m. Thursday, Cargill Inc. spokesman Mark Klein said. Wilczynski said the miners themselves prioritized who should come up first based on age, health and other factors.

First responders had been lowering food, blankets and other supplies down to the workers as the rescue operation progressed.

The men, who ranged from about 20 to 60 years old, had experience that ranged from a few months to more than 40 years, Wilczynski said. The third shift underground production crew was about to begin its night when the elevator came to a stop hundreds of feet beneath the earth's surface. The men were equipped with personal head lamps and whatever food they had brought to eat during a typical shift.

As the 10-hour ordeal dragged on, the men kept each others' spirits high by telling jokes and sharing stories, Wilczynski said.

Due to New York's light winter, Wilczynski said the mine's stockpiles are high and the company isn't "concerned with our ability to service our customers." He said the mine would not go back to work until safety checks had been completed, equipment had been inspected and the elevator was possibly replaced.

Lansing is roughly 40 miles southwest of Syracuse.

The Associated Press contributed to this report.