Rescuers try to reach five men who became trapped in a cave in Virginia's Russell County. All five were rescued and expected to recover. (WJHL)

Six men went into a Virginia cave, intending to spend the night. But their foray didn’t go as planned, and five of them ended up trapped for 47 hours more than 100 feet below ground.

They were rescued after a 16-hour operation that involved emergency personnel and experts from four states.

The men entered Cyclops Cave in Cleveland, Va., on Friday evening, planning to stay until Sunday. But after heavy rain set in Saturday night, they ran into trouble as they tried to get out. One of the men scaled the cave’s walls, climbed out and called 911.

On Sunday, Gov. Ralph Northam (D) wrote on Twitter that all five of those who were trapped “have been safely rescued.”

One of the men who was rescued told WCYB-TV, “The Lord watched over us.”

When rescuers got the other men out, they were suffering from extreme exhaustion and hypothermia, rescuers told WCYB. The men ranged in age from their 20s to late 50s, according to media reports.

The man who managed to climb out and call for help told dispatchers, “I have a couple of buddies down in this cave,” according to CNN. He added, “We got down okay, but our ropes got too muddy, and we can’t get up.”

“No one’s hurt, but they’re freezing and thirsty,” he said.

Rescue experts said it took a long time to get the cavers out because of the small size of the space — about width of a grown man’s shoulders. And once they were inside, rescuers had to “assess the situation and then report back” because cellphones and radios didn’t work inside the cave, according to CNN.

Eric Stanley, one of the volunteers helping in the cave rescue, said, “When we found the lost cavers, they were in good spirits.” He said the cavers were brought food and drinks and eventually rescued at different spots.

Another rescuer — William Chrimes, a search-and-rescue specialist with the Virginia Department of Emergency Management — told WCYB that as “exhaustion and hypothermia progressed, they were going to run into more and more problems having the energy to move and get out of the cave on their own.”

Chrimes said the rescue was highly technical because there were “very restricted passageways,” making it tough to get to the cavers.

“It’s a process, but this is what we train for, so there were no hiccups today,” Stanley said. “Everything went really smoothly.”

Jess Powers, emergency management coordinator for Russell County, told CNN that all of the men were taken to hospitals. One man was airlifted out, but all were expected to recover, according to officials.

The cave is named for a “bubble­like formation” that is meant to be the “eye” of a cyclops, according to CNN. The spot is on private property, and WCYB said the men did not have permission to be there, although it is a popular spot for cavers.

On WJHL-TV, Frankie Smith — owner of the 100-acre property where Cyclops Cave is located — said “a lot of experienced cavers” explore the cave, which has about three levels. But he warned that explorers sometimes do not realize how far down it goes and that the rocks in and around it can be particularly slippery after rain.

Smith, whose cattle farm has several other caves, said he would start to lock the gates to the area of Cyclops Cave.