Outside Yosemite National Park's wildlife management building, Caitlin Lee-Roney, head of the park's bear unit, holds up a tangled mass of aluminum that looks like it had passed through a meat grinder. “I brought this out because it’s a good example that nothing is safe from bears,” she tells me. “This is a beer can.”

It's July—high season for visitors at the park, and the time of year when park staffers are on high alert for bear encounters. Bears have gone to some impressive lengths in pursuit of the hot dogs and graham crackers we bring to the park. They’ve opened car doors with their paws and pried open locked, supposedly bear-proof dumpsters. These are examples of "habituation," Lee-Roney explains, which occurs when the animals become so familiar with a barrier we put between them and a source of food that they develop a knack for circumventing or overcoming it. This is why you can't just leave your snacks in the car when you go to bed at night—savvy Yosemite bears learned that trick decades ago. And when one bear learns, the others can pick up the knowledge through observation—the animals have remarkable memories.

Humans have responded to their intelligence with innovations of our own. We've devised locking mechanisms on dumpsters and trashcans, and garbage pickups in parks run like clockwork. We’ve brought this same measure of caution to the backcountry, where the standard food container is the bear canister, which is designed to withstand intense force and pressure. These preventative measures aren't put in place to stop the bears from getting fat, they're designed to keep bears from getting so comfortable with humans—and so aggressive in their pursuit of our food—that we have no choice but to put them down. It's not that we need to be protected from them; they need protection from us.

She stalks a particular backcountry campsite at night, sniffing out canisters stashed near ground level, moves them to a nearby 300-foot-high ledge, then lets gravity take over. The bear then scrambles to the base of the cliff and retrieves the goodies. To this day, no one has seen her in action.

Though park staffers have had success with bear-proofing—human-bear encounters are down from a record high of 1,541 in 1998 to fewer than 200 a year—there’s been a worrisome development. Two summers ago, in a shocking turn, park staffers found that one female black bear in the Snow Creek area, northeast of Yosemite Valley, had learned how to crack open bear canisters—a veritable coup in the human-bear innovation race. She doesn’t paw or jaw the canisters into submission. Instead, she stalks a particular backcountry campsite at night, sniffing out canisters stashed near ground level, moves them to a nearby 400-foot-high ledge, then lets gravity take over. “I think she kind of rolls them,” says Lee-Roney. The bear then scrambles to the base of the cliff and retrieves the goodies. To this day, no one has seen her in action.

This may sound like a cute Yogi Bear situation, but the stakes are high. If other bears were to start mimicking this female’s behavior, the entire canister system—a key means of mitigating bear encounters in the backcountry—could be undermined. The population of wild black bears has exploded in California in recent decades: there are about 40,000 of them right now, according to Mazur. To make matters more complicated, they are less habituated than they’ve been in decades. In short, if one bear picks up the behavior of the one in Snow Creek, another could soon follow. “One person can change a bear’s behavior permanently,” says Rachel Mazur, head of Yosemite’s wildlife management department. It would be a free-for-all on backpackers’ food supplies and would almost certainly lead to incidents.

Park staffers couldn’t let that happen. They caught and collared the bear last year in order to track her, and set up extra patrols at the Snow Creek area both to haze the bear and to instruct backpackers to camp far from the ledge. The incidents stopped—but only temporarily. The bear started swiping canisters in the same area this summer. If another bear starts picking up her habits, park officials say, Yosemite's wildlife management department may pursue more drastic measures—maybe even euthanasia.

Black bears are nature’s opportunists when it comes to eating, and that opportunism has challenged Yosemite since its first days as a park in the mid-nineteenth century, says Mazur, who is the author of Speaking of Bears, a history of black bear management in the Sierras. In the early days, trash was simply tossed into open garbage dumps scattered throughout the park. The dumps attracted bears, Mazur writes, and the scavenging bears attracted curious park visitors.

Park management were well aware of the ways that feeding black bears might increase annual visitation. By 1923 the park had allowed a concessionaire, the Yosemite National Park Company, to establish a formal bear-feeding platform where visitors were guaranteed a show. But the garbage dumps weren’t far from roads, and visitors began feeding bears from their car windows. Injuries weren’t uncommon. Mazur notes that 67 people were hospitalized in incidents linked to bear feeding in 1937 alone. The more that black bears received food from people or manmade structures, the more habituated they became, leading to more and more interaction with people. “In late summer and fall, after visitation subsided and the dumps were no longer used, they would head to the upper east end to forage at residences,” Mazur writes in her book. “The resulting conflicts could be intense.”

Yosemite finally closed the bear-feeding stations in 1941, but that didn’t deter the bears like staffers had hoped. The animals raided campgrounds and continued roadside begging. The bear situation worsened, according to Mazur, until 1963, when bear-proofing “began in a meaningful way” with metal garbage lids. But that didn’t stop bears from ripping into cars.

Caitlin Lee-Roney remembers when one bear figured out how to open car doors. Within five years, three bears had learned the technique. They became so comfortable that “one of them actually got in and the door closed behind him.”

Lee-Roney, who has been at the park for 16 years, remembers when one bear figured out how to open car doors. Within five years, three bears had learned the technique. They became so comfortable that “one of them actually got in and the door closed behind him,” Lee-Roney says. When wildlife officials approached the car, they found the bear napping inside.

The dumpsters currently in use feature a curved input outfitted with a trap door and locking carabiners. They are the products of decades of evolution—upgraded with new features as bears bypass the old ones. For a while, the park used lockers outfitted with latchkeys. But campers would leave the keys in the keyholes and bears would paw at them until they turned and unlocked. Staffers have altered the shape of the openings on recycling bins (they’re circular, upgraded from square, so bears can’t fit a paw inside) and welded metal ridges onto the edges of dumpster hoods (another paw-blocking move). Most recently, they’ve welded clips onto garbage lids. The innovation, Mazur says, is “almost endless.”

Two black bears in Yosemite have been euthanized by park staffers this year. Each instance is a tragedy for the bears and the bear unit alike, but the number represents an improvement from the days when Sierra bears were put down by the dozens. (In her book, Mazur mentions that over 100 bears were killed in Yosemite, Sequoia, and Kings Canyon national parks within a few years in the 1960s.)

Wildlife officials won’t decide to euthanize a bear until it convenes a committee to consider if the animal exhibits enough red flags to warrant being permanently dispatched. Such red flags, says Mazur, include unprovoked aggression to park visitors and consistently breaking into human structures where food has been properly stored. She stresses that aggression and property damage alone aren’t necessarily enough to warrant a vote to euthanize. If the aggression stemmed from a mother protecting her cubs, or if property was damaged due to faulty food storage, a bear’s reaction may be interpreted as reasonable. A vote to kill a bear is not taken lightly. “At the end, if you have to kill a bear—who does it? The ones that have worked the most to save it."

Staffers continue to monitor the Snow Creek bear’s behavior. They recently traded out her telemetry collar for a GPS collar, which will allow them to track and map her movement with greater precision. Right now, says Mazur, “this is one bear in one unique situation.” While the option to euthanize is on the table, wildlife officials may also consider banning campsites in vicinity of the ledge altogether. Mazur says that bear behavior is a reflection of our own; all it takes to turn a bear into a liability is one mistake from one careless camper.

*Correction: A previous version of this story misspelled Rachel Mazur's name.