A California man’s life was saved Friday after he became trapped in a hole on Sunset Cliffs in San Diego County.

The rescue mission took about 20 hours to accomplish once the San Diego Fire-Rescue Department was notified that someone saw the man in the hole on Thursday afternoon, NBC San Diego reported.

The man was apparently conscious, but he was unable to climb out of the hole. One official told reporters at the scene:

So, waist down, it was crushed all with rock and debris. So, as he fell in and as he slid down through that hole about 15 to 20 feet, all that compressed around him, and of course, when you’re trying to climb out, everything starts coming again. And it just slowly compressed everything in on his body, and the rocks moved in around it, too.

Authorities claimed the man had been trying to create a shelter but became wedged when he fell. To make the situation more tense, a storm moved into the area during the rescue operation. Therefore, authorities were forced to pause their efforts and wait for the tide to go back down.

However, they made sure to keep the hole covered. They also kept the man warm and gave him IV fluids and drinks to help sustain him throughout the night.

The man lost consciousness for a while, but firefighters monitored him constantly and kept him warm. The NBC report noted rescuers stayed with him throughout the night.

A photo shows crews at the scene working to free the man:

Several agencies helped during the operation, and a crew with the San Bernardino County Sheriff’s Department that performs cave rescues also arrived to help save the man’s life.

The team worked to split the large rocks so they could be removed. The man was finally freed from the hole at approximately 11:00 a.m. on Friday.

Photos show the man on a stretcher as he is lifted away from the rocky cliffs:

Authorities said that when the man was extricated from the cliffside, he thanked the crews for their efforts. He was then taken to a local hospital but reportedly only suffered minor injuries during the incident.

One neighbor who watched the rescue unfold told NBC News, “It’s a Christmas miracle. That’s all I can say.”