A Scoutmaster fought off a black bear with a rock hammer after it mauled him in a cave on Sunday afternoon, officials said.

Christopher Petronino was hiking with three Scouts when they stopped near the Split Rock reservoir, according to the New Jersey Department of Environmental Protection.

But after the 50-year-old entered the cave “a black bear grabbed his foot and pulled him further" inside, the DEP's statement said. “The bear then bit the victim’s leg, his right shoulder and then his left shoulder.”

Grabbing his rock hammer, the Scout leader struck the beast twice in the head, before pulling his sweatshirt off over his head and curling into the fetal position.

Outside the cave, the Scouts called 911 on Petronino’s cellphone but they were unable to give the dispatcher specific information about their location.

Petronino said he could hear the bear “huffing” as he kept his back to the animal and yelled at the boys to take out any food they had and leave it at the mouth of the cave.

After “a substantial amount of time,” the bear lumbered out and after one of the Scout's dogs barked and snarled at it, it ran up the hillside.

Scoutmaster Christopher Petronino being airlifted to hospital. WNBC

As soon as he heard the bear leave the cave, Petronino followed it outside and used the cellphone to provide police with a better description of their location.

Officials told NBC New York that an estimated 80 minutes elapsed between the Scout's 911 call and his.

Area police firefighters and a state police helicopter had been searching for the Scouts and were able to locate them using the GPS coordinates of the cellphone. Petronino was later airlifted to a hospital.

His father Michael Petronino told NBC News early Monday that the Scoutmaster was in “bad shape” and would have to undergo several hours of surgery.

The attack occurred a day after the end of the state's extended bear hunting season. Hunters killed 504 bears during the season, according to state records.