SAN DIEGO — A man heard screaming for help from a cliffside at Torrey Pines was finally rescued after firefighters worked through the night to reach him, officials said.

A 911 caller told dispatchers they heard the man yelling from the cliffs below the Torrey Pines Gliderport around 8:45 p.m. Saturday, San Diego Fire Deputy Chief David Gerboth told OnScene TV.

Firefighters arrived but couldn’t find the stranded person in the darkness. They eventually called in a helicopter to help with the search.

Rescuers finally located the man, but he was in a “very precarious” position on difficult terrain, Gerboth said. Crews decided they could not safely use the helicopter to hoist him to safety.

The deputy chief estimated the man was “mid-slope” on a 350-foot cliff.

Video showed a tactical rescue team with SDFD rigging up ropes and driving stakes into the ground at the top of the cliff. It created a system that allowed them to safely lower a rescuer.

Eventually that firefighter reached the man, loaded him into a basket and brought him down to the sand, Gerboth said. He had only minor injuries but paramedics took him to the hospital for evaluation.

It wasn’t immediately clear if the man got lost before calling for help, or why he was still in the area after nightfall. Paths on the cliffside are not formally marked or open to the public, according to Gerboth. He said people should stay out of the area to avoid dangerous rescues.

“The trails in these areas are not all official trails, and so you’re definitely taking your risk being here,” he told OnScene TV. “The cliffs themselves are often eroded. The trails, since they’re not official, they don’t have markings and lead to dead-ends and areas to get stuck. So please be careful. Use the official, well-marked trails.”

The rescue took “several hours,” lasting well into the early morning Sunday.