By any standard, Glacier National Park in northwest Montana, contains some of the United States’ most breathtaking landscapes.

Ragged mountains chew at the sky. Lakes twinkle cold and clear in valleys perfumed by thick stands of spruce and fir.

The wild animals that live here count among the country’s most charismatic: grizzly bears, mountain goats, bighorn sheep. To visit there is to be nature’s guest.

On almost any given day during the warmer months, visitors flock to Logan Pass, where Glacier’s main thoroughfare tops out at 2,012 meters (6,600 feet) above sea level just where a foot trail begins that punches up even higher. Take a hike here, and you’re almost guaranteed to encounter wildlife that comes to graze on grasses and berries. That’s when things can go wrong.

“A lot of people have never seen a mountain goat or a bighorn sheep and are tempted to get too close,” says Mark Biel, a natural resources program manager with Glacier National Park.

“These animals may look cute, but they can kill you.” The solution? Gracie the “bark ranger,” a family-friendly border collie trained to keep wildlife and humans apart.

Gracie’s presence makes the animals skedaddle. All Biel has to do is walk with Gracie on her leash into areas where humans and animals can clash — on a trail, in a parking lot, in a campground.

“A bighorn sheep will see this toothy thing looking at them very intently, creeping toward them in a low stance, and it triggers an instinct that says, ‘We’re about to be eaten,’” Biel says.

“That’s very different from other untrained dogs that walk with their owners through a parking lot and don’t really pay attention.” Beyond the work dogs like Gracie do to help police track down criminals or sniff out contraband, man’s “best friends” help in several other unusual tasks.

At the Museum of Fine Arts, Boston, Riley, a Weimaraner , can sniff out pests that could damage precious art objects. At more than 70 airports across the United States, including in Albuquerque, New Mexico, people nervous about flying can find a friendly dog to pet and play with, activities proven to lower blood pressure and stress.

Other dogs can sniff out diseases like diabetes and cancer. And some can even help biologists track down whales. “Dogs are the only animal on the planet that evolved with humans, and so they have a unique desire to be helpful,” says Elena Wickman, a professional dog trainer at Wind River Canine Partners in Florence, Montana.

“Cats, monkeys, they can all benefit from us, but dogs see us as a genuine part of their unit. The way they have eyebrows and use them to be so expressive is because they learned that behaviour from humans.”

Since border collies have the instinct to herd animals, such as livestock, toward people and not move them away, bark rangers require training. Gracie entered a program that lasted 12 weeks, during which time Biel received some training himself.

He can use commands like “gee” and “haw” to get Gracie to turn left or right. Other commands let Gracie know when it’s time to work and when it’s time to relax, a moment that always comes with a reward.

“Cheese is her favourite,” Biel says. Gracie is getting older these days and doesn’t go out as much.

Still, it only takes a few seconds for an entire herd of bighorn sheep to clear a parking lot once they see her, focused and creeping toward them. Now, other parks, like Grand Canyon, have expressed interest in getting their own bark rangers.

Meanwhile, Gracie has proved to be excellent at another skill: educating park visitors on how to behave around wildlife. “People will come up to us all the time and ask about her,” Biel says.

“It’s a great opportunity for me to talk about how we can all work to keep wildlife wild.”