A Boy Scout leader was pulled into a cave by a bear in northern New Jersey but beat the animal away with a rock hammer while the three Scouts with him called for help, authorities said.

Christopher Petronino and the Scouts were hiking at Split Rock Reservoir on Sunday afternoon when he stopped to show the boys a cave, NJ.com reported. He dipped into a small crevasse leading to it, and the bear grabbed him by the foot and yanked him inside. It began biting his legs and shoulders, and Petronino fought it off.

"Petronino struck the bear twice in the head with a rock hammer. He then pulled his sweatshirt over his head and curled into the fetal position," Bob Considine, a spokesman for the state Department of Environmental Protection, said in a statement. "He yelled to the Scouts, who were outside the cave, to leave and go get help."

The boys used a cellphone to call authorities, who told them to place any food they had outside the cave to lure the bear away from Petronino. When it emerged, a dog that had come along with the group began barking and the bear ran up a nearby hillside.

The boys from Troop 69 likely saved Petronino when they used food to lure the bear out of the cave and called 911, officials said.

"I want to commend those young Scouts," said Dave Chanda, director of the state Division of Fish and Wildlife. "They knew what to do."

Considine said the Scout leader spent about 80 minutes inside the cave before escaping. He was airlifted to Morristown Medical Center and treated for his wounds. The Scouts, from a Boonton-based troop, were released to their parents.

Petronino, 50, told authorities he'd visited the cave regularly for decades and had never seen a bear.

Considine said state wildlife officials believe the bear was protecting its hibernation location. Initially, they placed traps around the area where the attack occurred and hoped to capture the bruin. Later, they told NJ.com that the warmer weather was confusing the bears and they are not deep into hibernation. The officials don't believe the bear is a threat and won't try to capture it.

Hunters in New Jersey killed 510 bears during the state's extended black bear hunt, which ended Saturday. Fifty-eight were harvested in Morris County, where Split Rock Reservoir is located.

The Scouts' encounter with the bruin demonstrates that it is "dangerous" to go so far into the woods these days because bears are so prevalent, said Lt. Peter Reilly with Rockaway Township police.

"They were several miles into the woods, far from any road or access point," Reilly said. "I wouldn't advise taking people into the woods at this point. There are a lot of bears all over in Rockaway Township. There are swimming bears and walking bears."