HARWINTON, Conn. (AP) — Wildlife biologists in Connecticut had to rescue a bear cub that got its head stuck in a plastic container, state wildlife officials said.

The misadventure happened June 23 when a mother bear with three cubs knocked over a garbage can in the town of Harwinton in Litchfield County, and one of the cubs stuck its head in a clear plastic jar that had spilled out.

“Given the warm weather and tight fit of the container, it was important to try and free the cub quickly,” the Connecticut Department of Energy and Environmental Protection’s Fish and Wildlife Division posted on Facebook.

Wildlife biologists waited for the cub to come down from the tree it was perched in and then tranquilized it and removed the container.

The bear was unhurt and quickly found its mother waiting nearby, the wildlife officials said.

DEEP spokesperson Will Healey said the incident shows why residents should make sure their garbage is property disposed of and secured. “We all need to do our part to keep bears and other wildlife safe and wild,” he said.