Wildlife officials rescued a bear cub from a dumpster in Pasadena, California, Thursday and reunited it with its mother.

The cub had become trapped in the bin and was frantically trying to get out while crying for its mother.

baby bear stuck in dumpster

"That gets mom a lot more excited, and mom's more in defensive mode,” J.C. Healy, a fish and wildlife official, told ABC 7 News.

Rescuers tried to assist by lowering a ladder into the dumpster, but the mother was too protective of her offspring to let them get close enough.

officials try to rescue bear cub

Officials frightened the mother bear away from the scene by shooting her with a harmless bean bag round, and they were then able to get the little bear out.

They helped the baby bear over a fence to find its mother, and eventually the pair were spotted entering a wooded area.

bears in Pasadena

Wildlife officials thought the ordeal was over, but the bears later returned and were seen feasting on a pizza box near another trash bin.

The mother and child later roamed around a backyard swimming pool before lying down to rest in another yard for several hours.

bears beside swimming pool

Because they posed no immediate threat, officials left them alone, and the bears eventually headed back to the woods.

Related on MNN: