Marin Search and Rescue carries a man for medical treatment after his rescue Saturday in Yosemite National Park. The man was trapped at the top of Vernal Falls, a 317-foot drop. (Marin Search and Rescue photo)

The Marin Search and Rescue team helped save a 19-year-old man who was clinging to a rock above a 317-foot waterfall in Yosemite National Park, a sheriff’s official said.

The incident occurred at about 3:45 p.m. Saturday, when the man was climbing on rock ridges along the Mist Trail, said Marin County sheriff’s Lt. Doug Pittman. The man fell and struck his head on a rock in Emerald Pool, a basin on the edge of Vernal Fall.

As the man clutched the rock, witnesses ran down the trail for help. The witnesses came upon members of Marin Search and Rescue, which was conducting its annual training trip for mountain rescues.

The team is not trained for swift-water rescues, but its members were able to set up anchors and a line across the water while Yosemite rangers got to the scene.

Meanwhile, the rescuers whistled and yelled at the injured man so he would not fall unconscious and get carried over the waterfall.

Pittman said the waterfall itself was dangerous enough to fall over, but there are also crevices along its sides that are known to trap fallen hikers.

“He could’ve been sucked down into one of these crevices,” he said. “It could have been months before he was found, or maybe never.”

Park rangers arrived in about 40 minutes, clipped onto the rescue line and retrieved the victim. The Marin team then carried him on a stretcher for a two-mile hike down the trail for medical treatment.

The entire operation took about three to four hours. Pittman said the man suffered a severe injury to the side of his head, a possible broken eye socket and hypothermia.

The man is a resident of Camarillo in Ventura County, said Kari Cobb, a spokeswoman for Yosemite National Park. The park did not release the man’s name.

Last month, a 19-year-old hiker from Sacramento was presumed dead after being swept over the 594-foot Nevada Fall, which is about half a mile up the Merced River from Vernal Fall.

Contact Gary Klien via email at gklien@marinij.com or https://twitter.com/GaryKlien