As Messenger crested a ridge, he came face-to-face with the bear, an encounter that surprised both of them. The grizzly was threatened by Messenger’s presence and tried to intimidate him with a few bluff charges, then attacked, swiping at his back and face and clamping its large jaws around his leg, barely missing his femoral artery—a bite that would’ve been fatal. Miraculously, Messenger survived to tell the tale and went on to work as a wilderness guide and search and rescue volunteer. Now he knows a little something more about bears and, more importantly, how to avoid and survive an encounter with an animal at the top of the backcountry food chain. His book about how he survived the attack, The Twenty-Ninth Day, comes out in November.

Grizzly bears are not to be messed with

“I was incredibly lucky,” Messenger says. Not only did he survive, but despite large wounds on his leg, immense pain, and having lost the tips of two toes, he escaped the ordeal without any life-threatening injuries. Grizzlies, after all, are large animals with built-in defenses: claws up to 4 inches long (as long as a human finger) and a body weight of up to 850 pounds. They can run as fast as 35 miles per hour—faster than the top speed of an Olympic sprinter—and stand as tall as 8 feet when on their hind legs. They are definitely not the sort of creature you want to meet in the woods. They’re omnivores, so they feed on salmon, squirrels, and even moose, but also berries, nuts, and vegetation. A lot of it. Still, bears rarely attack humans. In fact, in 2014, most backcountry fatalities in North America (83) were due to falls, and 12 people died from simply getting lost, whereas only two were related to grizzly attacks. But if bears feel threatened, they will defend themselves.

Protect yourself while in grizzly country

Naturally, the objective is to avoid a grizzly confrontation altogether. Most hikers will go their whole lives without spotting one in the wild, let alone meeting one on the trail. When you venture into their domain, hike in groups. In general, there’s safety in numbers, no matter which animal you encounter. More people means more noise, too, so talk, sing, and clap frequently. Don’t be shy. Most bears, when they hear noises they aren’t used to, will make themselves scarce and you’ll never even know they were nearby. Since the last thing you want is to surprise a bear—that’s usually when you force them into an attack—making noise is especially important when approaching blind corners, popping over ridges, or moving around obstacles such as large boulders. If you’re thinking about getting bear bells—those jingling contraptions you strap onto your backpack or ankle—you might want to reconsider. “The jury’s still out on whether or not they’re effective,” Messenger says. Finally, one of the most important things you can do to protect yourself in bear country is to always carry bear spray. Chances are you’ll never use it—most hikers won’t—but having it could save your life. Just don’t spray any around your tent or on your body as a precaution, as the smell can actually attract bears. It’s only effective if sprayed directly at the animal. As easy as these tips may sound, Messenger neglected all of them on that fateful hike in 2005.

What to do if you run into a grizzly

Keep in mind that the strategy for surviving a stand-off with a grizzly is much different from the approaches that may work with other bears. Black bears, for example, are smaller, lighter, and more easily scared off. Grizzlies, on the other hand, are big and they know it. If you ever find yourself face-to-face with one, don’t panic and don’t run. As we’ve said, you can’t outrun a grizzly. Even if you tried, the bear would likely pursue, which would make it angrier and even more dangerous. Contrary to what you’ve probably heard or seen on TV, you also shouldn’t climb the nearest tree. Bears are adept climbers and most likely better than you at it. Instead, try not to look like a threat. Avoid eye contact, back away slowly, and speak to the bear in a calm tone. Yelling will only make the situation worse. “I handled that initial encounter right,” Messenger says. “I held my hands up and said, ‘Whoa bear. Hey, bear. It’s OK, bear.’” It was exactly what he had been trained to do. If the bear is far off, just find another path that puts plenty of space between the two of you (at least 100 yards), and do it in a way that does not attract attention. But if the bear is within charging distance (50-100 yards), it has the upper hand and it becomes critical not to perturb the animal any more than you already have. If the bear turns and moves away, you’ve done your job and you should make a prompt, but wary, exit in the opposite direction. If it charges, use your bear spray. Always keep it where you can reach it within 1 second. If you have to fumble to remove it from a pocket or a bag, it won’t do you any good. Spray it toward the bear’s face when it’s about 30-60 feet from you. If you don’t have bear spray and the animal attacks, play dead by laying face down, interlocking your hands behind your neck to protect it, and spreading your legs wide to keep from being flipped onto your back. Messenger knew this was the right move, but he wasn’t sure when to do so and failed to practice. Ideally, he should have played dead as soon as the bear started charging. Instead, he dodged several charges, getting a swipe across his back and a slap across his face in the process, which likely aggravated the bear further. Without bear spray—he’d left it in his tent—Messenger also threw a hard Pelican case holding his camera at the bear. It’s a tactic he now doesn’t recommend, since it also likely made the grizzly angrier. “That does not align with what you’re supposed to do,” Messenger says, laughing. But after the animal bit his leg and knocked him out, he played dead “very effectively,” he remembers. Usually, if a bear perceives the threat has been neutralized (no matter the reason), it will leave you alone. The only time you should fight back instead of playing dead is if the grizzly is actively trying to eat you, which is extremely rare.

Prepare for everything

Whether or not you think you’ll ever encounter a grizzly bear, it’s important to know how to react. Imagine different encounters you might have with a bear (across a river, while in your tent, a surprise during dinner) and plan what you will do in each scenario. Messenger says the moment he saw the bear that attacked him, he immediately began running through the survival scenarios he’d learned during training. “If you pre-visualize it in your mind and think through the process of what you’re going to do, you’re more likely to do those things,” he says. “If you don’t, your brain is just going to wing it, and maybe panic.” Some hikers choose handguns for bear defense, but “that’s a sad outcome for the bear if bear spray would have worked,” Messenger says. Besides, according to the U.S. Fish and Wildlife Service and bear biologist Stephen Herrero, encounters where firearms were involved essentially doubled a person’s chances of serious injury. If you’ll be hiking in a park, it’s also a good idea to check with rangers before you head out to see if there have been any bear sightings or activity lately. They can tell you if you should be on alert and whether to avoid certain areas altogether.

Respect the bear

Despite his gruesome encounter, Messenger has tremendous respect for grizzly bears, holding no ill will toward the one that mauled him. “It was just a bear being a bear,” he says. “You can’t fault it for that.” The woods and wild places are their domain, after all—we’re just guests passing through. Messenger is fully recovered now, though a sporadic nagging pain in his leg remains. These days, he still frequently spends time outdoors in grizzly country, but when he heads into the woods, you’d better believe he always knows where his bear spray is.