Police say a Rutgers University student was killed by a black bear while hiking in a heavily wooded area of northern New Jersey. (Reuters)

There they were — 22-year-old Darsh Patel and four other men — hiking in the Apshawa Preserve, northwest of New York City, with a 300-pound black bear on their trail.

When the five friends, all of Edison, N.J., noticed the bear in pursuit, they split up and ran. Four of them were able to find each other, but none could find Patel.

They called police and, a few hours later, a search-and-rescue team located his body. The bear was less than 100 feet away, circling, West Milford police chief Timothy Storbeck told the Associated Press. It was “immediately euthanized,” West Milford police said in a statement.

“This is a rare occurrence,” Storbeck said.

It’s possible the bear was looking to attack but, more than likely, he was just looking for food, said Kelcey Burguess, principal biologist and leader of the state Division of Fish and Wildlife’s black bear project. The hikers were carrying granola bars and water with them, Storbeck said.

Or it’s possible the hikers showed their inexperience by running away — a mistake.

So what do you do if you come face-to-face with a black bear in the wild?

1. Don’t let it smell food

Wildlife ecologist Graham Forbes told CBC News that hikers and campers should keep food, garbage and even bird food put away.

“Black bears can be dangerous if they have lost their fear of people,” he said. “They associate food with people and if they’ve been trained as such by people not looking after their garbage, or they’ve learned that food and humans are similar so it’s a good place to go look for food … that’s when a bear can be dangerous.”

2. Don’t sneak up on a bear

Make noise because it may keep a bear at bay, Forbes said. Bears have bad eyesight and may not see a camper until he is too close.

But if a bear shows up, avoid looking it in the eye, New Jersey Department of Environmental Protection spokesman Larry Ragonese said. Forbes advised putting something on the ground — a jacket, a hat, a backpack — to distract the bear.

“That might give you a chance to keep backing away,” Forbes said.

3. Don’t fake your death

Bill Stiver, a wildlife biologist at the Great Smoky Mountains National Park, told ABC News playing dead only works with brown bears.

“Usually, if a black bear attacks you, it’s an offensive attack,” he said.

4. Don’t try to run away

It won’t work.

“Stand your ground. You can’t outrun a bear,” Stiver said. “You’re basically trying to show the bear you’re not afraid of it.”

And running may only incite the bear.

“A lot of predators have an instinctual response that if something runs, they’ll chase it,” Forbes said.

Forbes also noted that black bears are good bluffers. They’re known for stomping their feet, threatening to charge and then retreating.

“It’s hard to know, of course, if it’s going to stop or keep running,” he told the CBC. If the bear charges, it’s best to fight back — hard.

5. Put up a good fight

Wave your arms, hold up your hands, try to appear as tall as possible. If you’re in a group, stand together. Clap, yell and throw things.

“You’re trying to scare it away before it gets too close,” Stiver told ABC News. “Get a big stick, some rocks. Bang pots and pans.”

If the bear doesn’t back off and — worst-case scenario — moves in for the attack, “do everything you can to get that animal off you,” Stiver said.

Get physical. Punch and kick.

“Give it a kick, start swatting the best you can. Stand up tall,” Forbes said. “These sorts of things have been shown to work quite well.”

RELATED CONTENT: “Rutgers student killed by a bear while hiking in New Jersey

h/t CBC News