Bears don't want to attack people. We kill them far more often than they kill us, and many bears seem to be aware of that ratio. When they do attack, it's usually because they were either starved or startled.

Yet despite their hesitance, attacks have increased in many parts of the world. Yellowstone National Park has seen human-bear conflicts rise in recent years, for example, including two fatal attacks in 2011 (the park's first in 25 years) and another in 2015. In June 2016, a bicyclist was killed by a grizzly just south of Glacier National Park in Montana. Wildlife officials face similar issues around the U.S. and Canada, as well as other countries like Japan and Russia. This has been linked to a variety of factors, including habitat loss, human intrusion, food shortages and climate change.

Bear behavior is still heavily influenced by biology and upbringing, too: American black bears are relatively docile and skittish, for example, while polar bears are more aggressive and more likely to see people as prey. Yet trying to fully understand any bear attack is a daunting task, and since we can't convey our peaceful intentions to bears, it's generally safer to just stay away.

Nonetheless, occasional run-ins are inevitable. Most people are as surprised to see a bear as it is to see them, and the ensuing interactions are often rife with misunderstanding. The species, time of year and other details dictate the best response, but here's an overview of how to handle these harrowing encounters:

Brown bears

Chase Dekker/Shutterstock

Brown bears (aka grizzly bears) are the most widespread bear species in the world, found across much of Eurasia and northwestern North America. They're generally bigger and more aggressive than black bears, but color alone isn't a reliable way to tell them apart. Notice the bear's size, too, and look for a hump of muscles in its upper back, a trademark of brown bears. Also remember where you are — grizzly country is expansive in Europe, Asia and Canada, but in the U.S. it's limited to Alaska and parts of Idaho, Montana, Washington and Wyoming.

Conflicts with North American grizzly bears (pictured above) have been rising in the U.S., due partly to growing grizzly and human populations, and partly to food shortages that some scientists blame on global warming. But climate change may also expand grizzlies' range, possibly even into polar bear habitat.

If you encounter a brown bear, keep these tips in mind:

Always carry bear spray. This is a must-have in grizzly country, preferably in a holster or front pocket since you'll just have a few seconds to fire. (Bear spray can actually be more useful than a gun for grizzlies, since one or two bullets may not stop a full-grown adult quickly enough.)

This is a must-have in grizzly country, preferably in a holster or front pocket since you'll just have a few seconds to fire. (Bear spray can actually be more useful than a gun for grizzlies, since one or two bullets may not stop a full-grown adult quickly enough.) Don't be stealthy. If you think bears are in the area, talk, sing or make other noises to let them know you're there, too — without surprising them. If you see a bear that doesn't see you, don't disturb it.

If you think bears are in the area, talk, sing or make other noises to let them know you're there, too — without surprising them. If you see a bear that doesn't see you, don't disturb it. Don't be a tease. Unattended food and trash are surefire bear magnets, even if they're tied up. Try to produce minimal waste when camping or hiking, and secure all food and trash carefully (bear canisters are required in some parks). Bears can also be lured by dogs, so it may be wise to leave pets at home.

Unattended food and trash are surefire bear magnets, even if they're tied up. Try to produce minimal waste when camping or hiking, and secure all food and trash carefully (bear canisters are required in some parks). Bears can also be lured by dogs, so it may be wise to leave pets at home. Don't run. If you do meet a grizzly, stand tall, stay calm and slowly reach for your bear spray. Don't worry if the bear stands up — that usually just means it's curious. Back away slowly if you can, still ready to spray. If the bear follows you, stop and stand your ground.

If you do meet a grizzly, stand tall, stay calm and slowly reach for your bear spray. Don't worry if the bear stands up — that usually just means it's curious. Back away slowly if you can, still ready to spray. If the bear follows you, stop and stand your ground. Aim and spray. The best distance to spray a charging bear is about 40 to 50 feet. The idea is to create a wall of pepper spray between you and the bear.

The best distance to spray a charging bear is about 40 to 50 feet. The idea is to create a wall of pepper spray between you and the bear. Hit the dirt. If the bear keeps charging, fall down and lace your fingers over the back of your neck to protect it. Guard your stomach by lying flat on the ground or by assuming a fetal position, with knees tucked under your chin. Don't move.

If the bear keeps charging, fall down and lace your fingers over the back of your neck to protect it. Guard your stomach by lying flat on the ground or by assuming a fetal position, with knees tucked under your chin. Don't move. Play dead. Even if the bear starts to attack, it's likely trying to neutralize you as a threat. And since you'll never outrun or overpower it, faking death is your best bet at this point. Even if it walks away, don't get up. Grizzlies are known to linger and make sure you're dead, so stay down for at least 20 minutes.

Even if the bear starts to attack, it's likely trying to neutralize you as a threat. And since you'll never outrun or overpower it, faking death is your best bet at this point. Even if it walks away, don't get up. Grizzlies are known to linger and make sure you're dead, so stay down for at least 20 minutes. Box its nose or eyes. This could feasibly thwart a grizzly attack, but only fight back as a last resort. Playing dead is the preferred strategy with grizzlies. If you can get free, though, back away slowly; still don't run.

Black bears

David Osborn/Shutterstock

The two major types of black bears, American and Asiatic, are separated by the Pacific Ocean, but they're still more closely related to each other than to the brown bears that share their habitats. The American black bear (pictured) is North America's smallest and most common bear, with some 900,000 ranging from Alaska to the Atlantic, while Asiatic black bears (found in China, Japan, Korea and Russia) are more threatened, both by deforestation and the controversial practice of "bear farming."

American black bears occasionally attack humans, but since they're smaller, faster and better climbers than grizzlies, they'd usually rather flee than fight. Asiatic black bears, on the other hand, are more prone to attack people, a problem scientists say could worsen with climate change.

If you encounter a black bear, keep these tips in mind:

Be bear-aware. In general, take the same precautions you would in grizzly country: Carry bear spray in areas where black bears are active, keep food and trash packed away, and make noise when walking through the woods so you don't surprise any hidden bears.

In general, take the same precautions you would in grizzly country: Carry bear spray in areas where black bears are active, keep food and trash packed away, and make noise when walking through the woods so you don't surprise any hidden bears. Stand your ground. Black bears are less aggressive than grizzlies, so as long as you demonstrate yourself to be large and loud, they'll usually leave you alone. Shout, wave your arms and create a commotion. Use sticks or other objects to make yourself look even bigger. And just like with grizzlies, never run from a black bear. They often bluff charges, and the best strategy is to stay in place with bear spray ready to fire if the bear gets too close.

Black bears are less aggressive than grizzlies, so as long as you demonstrate yourself to be large and loud, they'll usually leave you alone. Shout, wave your arms and create a commotion. Use sticks or other objects to make yourself look even bigger. And just like with grizzlies, never run from a black bear. They often bluff charges, and the best strategy is to stay in place with bear spray ready to fire if the bear gets too close. Stay on the ground. Never climb a tree to escape a black bear. They're excellent climbers, and they tend to chase anything they think is running away, so there's a good chance it would trap you in the tree.

Never climb a tree to escape a black bear. They're excellent climbers, and they tend to chase anything they think is running away, so there's a good chance it would trap you in the tree. Use bear spray. It can help, but it's not as critical as with grizzlies. The same principle applies, though: Try to spray when the bear is 40 to 50 feet away, creating a wall of pepper spray in front of you.

It can help, but it's not as critical as with grizzlies. The same principle applies, though: Try to spray when the bear is 40 to 50 feet away, creating a wall of pepper spray in front of you. Fight back. Unless you're physically unable, it's often better to defend yourself against a black bear than to curl up on the ground. Keep making noise and looking large throughout the encounter, but if you end up at close range, use any nearby object as a weapon to fend off the bear. If nothing useful is around, punch or kick the bear's nose. Do whatever is needed to scare it away, but focus on sensitive areas that are likely to get an immediate reaction. Try to create space between you and the bear, but never run away — make the bear do that.

Polar bears

AndreAnita/Shutterstock

Polar bears are not only the biggest bears alive; they're also the largest of all land carnivores. They aren't as omnivorous as other bears, instead feeding mainly on seals and fish. They pile on lots of fat from this diet, packed onto their sturdy frames to endure the bitter Arctic winter. Humans are no match for any bear one-on-one, but with polar bears the contest is especially lopsided. They're also less accustomed to seeing people, and are more likely to view us as prey. But they live in relative isolation in the Arctic, and are reclusive enough that attacks on humans are rare.

The relationship has only recently soured due to effects of climate change, since Arctic warming means less sea ice, which polar bears use as platforms to hunt seals. Hungry polar bears are now going farther inland for food, a habit that increasingly puts them at odds with humans.

If you encounter a polar bear, keep these tips in mind:

Good luck. Polar bears are the biggest bears on Earth, and they're much harder to scare than brown or black bears. The best strategy is to avoid meeting them in the first place.

Polar bears are the biggest bears on Earth, and they're much harder to scare than brown or black bears. The best strategy is to avoid meeting them in the first place. Don't act like prey. This is good advice for any bear encounter, but especially so with polar bears. They're the most likely species to see you as a meal, and running away will only confirm their suspicions. Plus, they're faster than you, and much better at running on snow and ice.

This is good advice for any bear encounter, but especially so with polar bears. They're the most likely species to see you as a meal, and running away will only confirm their suspicions. Plus, they're faster than you, and much better at running on snow and ice. Do act like a threat. The bear may see through this tactic, especially if it's hungry, but it's still worth a shot. Don't draw attention to yourself if the bear doesn't see you or seems uninterested, but if it approaches, stand up straight, speak loudly and act like it should be scared of you. This video offers a good example.

The bear may see through this tactic, especially if it's hungry, but it's still worth a shot. Don't draw attention to yourself if the bear doesn't see you or seems uninterested, but if it approaches, stand up straight, speak loudly and act like it should be scared of you. This video offers a good example. Use bear spray. It's your best bet, since you can't count on intimidating a polar bear, and their habitat doesn't offer many hiding places. As in grizzly country, be sure the spray is easy to reach, and learn how to use it before you go. (But don't let those gusty Arctic winds blow away your protective cloud — try to anticipate the wind before you spray.)

It's your best bet, since you can't count on intimidating a polar bear, and their habitat doesn't offer many hiding places. As in grizzly country, be sure the spray is easy to reach, and learn how to use it before you go. (But don't let those gusty Arctic winds blow away your protective cloud — try to anticipate the wind before you spray.) Don't give up. Unfortunately, neither playing dead nor fighting back works as well against polar bears as against their smaller relatives. They're often more interested in eating you than in neutralizing you as a threat, so playing dead might just make their job easier. Fighting back is pretty useless, too, but if you find yourself rolling around the tundra with a one-ton polar bear, you don't have much to lose. As with other bears, try to injure its nose or eyes, and steer clear of those big, swinging paws. A single strike can kill a person.

What about other bears?

Ondrej Prosicky/Shutterstock

While black, brown and polar bears are the most well-known varieties, there are also several other types spread around the world, albeit in fewer numbers and covering less area. They all sport dark-colored fur to some degree, but they're not closely related to American or Asiatic black bears, or to one another. Below is a quick look at some of the planet's lesser-known bears; each one has its own behavioral quirks, but none are considered serious threats to human safety. As with all bears, anticipate their presence when you're on their turf, and avoid an encounter whenever possible.

If you are attacked, follow the same general guidelines for the bears listed above.

Sloth bear: Covered with dark, shaggy fur, sloth bears inhabit the forests and grasslands of the Indian subcontinent, mostly at low elevations. They primarily eat termites, but as omnivores, they're also known to feed on eggs, carrion and plants. They're not especially big — ranging from 100 to 300 pounds — but they can be aggressive toward people. The species is listed as Vulnerable by the International Union for Conservation of Nature (IUCN).

Covered with dark, shaggy fur, sloth bears inhabit the forests and grasslands of the Indian subcontinent, mostly at low elevations. They primarily eat termites, but as omnivores, they're also known to feed on eggs, carrion and plants. They're not especially big — ranging from 100 to 300 pounds — but they can be aggressive toward people. The species is listed as Vulnerable by the International Union for Conservation of Nature (IUCN). Spectacled bear : The small, shy spectacled bear is the only surviving member of its taxonomic subfamily, Tremarctinae, and is also the only bear species indigenous to South America. It exploits a wide range of habitats, including rain forest, cloud forest, steppes and coastal scrub desert, but is concentrated mainly in the forested mountains of Bolivia, Colombia, Ecuador, Peru and Venezuela. It's listed as Vulnerable by the IUCN.

: The small, shy spectacled bear is the only surviving member of its taxonomic subfamily, Tremarctinae, and is also the only bear species indigenous to South America. It exploits a wide range of habitats, including rain forest, cloud forest, steppes and coastal scrub desert, but is concentrated mainly in the forested mountains of Bolivia, Colombia, Ecuador, Peru and Venezuela. It's listed as Vulnerable by the IUCN. Sun bear: As the smallest of all bear species, sun bears are easy to overlook. They slink around at night through tropical forests in Southeast Asia, feeding mainly on termites, ants, beetle larvae, bee larvae and honey, as well as a wide variety of fruits, especially figs. This reclusiveness helps reduce conflicts with people, but sun bears are still threatened by habitat loss and human development. The IUCN also lists them as a Vulnerable species.

As the smallest of all bear species, sun bears are easy to overlook. They slink around at night through tropical forests in Southeast Asia, feeding mainly on termites, ants, beetle larvae, bee larvae and honey, as well as a wide variety of fruits, especially figs. This reclusiveness helps reduce conflicts with people, but sun bears are still threatened by habitat loss and human development. The IUCN also lists them as a Vulnerable species. Giant panda: Despite the common misconception that giant pandas are related to raccoons, they are a type of bear, the sole surviving member of the Ailuropoda genus. More than 99 percent of their diet consists of 30 bamboo species, although they can digest meat, too. This mostly vegetarian diet reduces their likelihood of attacking people, but perhaps the main reason attacks are rare is that giant pandas themselves are rare. They live in just a few mountainous areas in central China, but captive breeding programs are aimed at introducing captive-bred pandas to the wild. The species is listed as Threatened by the IUCN.

For more advice on how to survive a run-in with a bear, check out this video: