TOKYO — Hungry bears with a taste for grapes and chestnuts are causing havoc across Japan, and thousands of the animals are ending up dead as a result.

Two people have been killed and almost 100 have been injured this year as human-bear encounters soar, according to Environment Ministry data and media reports. Four prefectures have put residents on high alert, with some children carrying bells on their way to school.

Farmers are counting the cost this week after bears raided their vineyards and munched through thousands of dollars’ worth of premium grapes. Crop losses in many areas are rising.

But the news is even more grisly for the bears. More than 9,000 Asiatic black bears have been caught and killed since the start of 2019, according to the Environment Ministry, by far the highest rate since such data-keeping began in 1950.

Fuminori Tsukidate, the manager of a vineyard in Aomori prefecture, said workers had noticed grapes were being eaten, but they were initially unsure whether to blame bears or raccoons. One bear was caught in a drum trap containing honey last year, but the raids continued. So workers installed a security camera.

Tsukidate said he was “amazed” to see an intruder — thought to be the offspring of the animal caught last year — getting in by flattening a six-foot-high fence with its front legs.

This bear scoffed around 5,000 bunches, or about 900 pounds, of grapes, although it did so carefully, plucking the grapes and leaving the stems. Still, that’s only a small proportion of the total harvest of about 45 tons, he said.

“It’s not so much about the loss, but our concern is the danger to our employees,” Tsukidate said.

Bears have been spotted on school grounds and even wandering around a shopping mall in central Japan’s Ishikawa prefecture in recent weeks. Another bear injured four people, at one point ramming into a police car and puncturing a tire with its claws. Once located, the bears were shot.

A 73-year-old farmer died after a bear attack in Niigata prefecture on Oct. 1, and an 83-year-old woman was attacked by a bear on her way home from picking chestnuts in Akita prefecture on Oct. 7. She died a week later.

A shortage of acorns is propelling the bears down from their mountain homes in search of food ahead of their winter hibernation, but that’s only half the story.

As Japan’s rural population shrinks, people have pulled out of the foothills that formed buffer zones between the bears’ mountain homes and the populous flatlands.

“Those farmlands have been abandoned, and they have grown into forests,” said Shinsuke Koike, an associate professor at Tokyo University of Agriculture and Technology. “They, in turn, become part of the habitat for bears, boars and monkeys. Gradually, the habitat for wild animals is expanding toward flatter areas across Japan and approaching the flat areas just behind populated areas.”

Bears are naturally timid, but once they discover food sources, they become bolder, Koike said. When confronted by humans, they often panic and may harm people as they try to flee.

Bears with a taste for grapes have also made headlines in California in recent years.

In Japan’s Yamagata prefecture, a farmer complained this week that bears ate nearly $1,000 worth of premium shine muscat grapes, with public broadcaster NHK capturing one animal in action.

Asiatic black bears — closely related to the American black bear — live in mountains and forests from Japan to China and across the Himalayas to India. They are also known as moon bears because of a white marking on their chests, roughly in the shape of a crescent moon. They are typically about five feet tall and weigh a little over 200 pounds, but an adult male can tip the scales at twice that number.

They are classified as “vulnerable” on the International Union for Conservation of Nature’s red list of threatened species.

An Environment Ministry study estimated Japan’s black bear population at between 12,300 and 19,100 in 2011, but the numbers may have risen since then — at least until the latest spate of killings.

Across East Asia, especially in China, more than 20,000 black bears are kept in tiny cages and their bile extracted for use in traditional medicine.

Environmentalists say buffer zones need to be created between the animals’ mountain habitats and human settlements.

“Over the past decade, the response has been to catch them as they appear in populated areas. But that’s a tentative solution and like a whack-a-mole,” Koike said. “We certainly need to remove problem bears, but we also need to implement policies not to create those problem bears without delay.”