Three bears that snuck into a tatami mat factory in northern Japan and holed up inside for nearly a day have been captured, according to town officials.

A patrolling town official spotted the bears, believed to be a parent and two cubs, as they walked into a tatami factory Wednesday morning in Misato, a town in Akita prefecture, where there’s been a growing number of reported bear attacks in or near residential areas.

An owner of the tatami factory said he saw the bears walking outside but never thought they would come inside.

GRIZZLY BEAR ATTACK IN BANFF NATIONAL PARK LEAVES COUPLE, DOG DEAD

Town officials and police officers rushed to the site, each wearing a helmet and carrying a shield, and kept watch. Local hunters used fire crackers to try to scare the intruders out, without success. They later set up a pair of cages at the entrance of the tatami factory and waited overnight.

On Thursday morning, the bears were trapped in cages, two cubs in one and the adult in another. Television footage showed the cages being taken out of the factory and placed on a pickup truck with a crane.

Misato issued an urgent message later Thursday to residents that all three bears had been captured. Media reports said the bears were later killed for fear that they would return to town and pose harm again if released.

Akita has logged a record 30 cases of bear attacks on people in 2023 alone, increasingly in residential areas. Experts say they come down from forests looking for food due to a scarcity of acorns, their staple food. Officials warned residents not to leave garbage outside, and advised hikers to carry bells to make noise, and use anti-bear spray or lie flat face-down in case of an encounter with bears.