Mama Bear, Cub Wander the Hallways at School in Altadena

A female black bear and cub wandered down the hallway at a charter school at the edge of the Angeles National Forest in Altadena Tuesday.

Pasadena Rosebud Academy provided this image of a bear on campus on Oct. 24, 2017.

Pasadena Rosebud Academy provided this image of a bear on campus on Oct. 24, 2017.

The bears were first spotted by an eighth-grade student, according to Shawn Brumfield, director of Pasadena Rosebud Academy.

The student quickly reported the sighting to the school’s office, where officials called the Crescenta Valley Station of the Los Angeles County Sheriff’s Department. The school was put on lockdown while staff monitored the bears as they roamed about the campus, Brumfield said.

At one point the bears got into some garbage cans during their hourlong visit. Eventually, they hopped a fence and left the area before sheriff’s deputies arrived.

Pasadena Rosebud Academy provided this Snapchat image of a bear on campus on Oct. 24, 2017.

Pasadena Rosebud Academy provided this Snapchat image of a bear on campus on Oct. 24, 2017.

Photos of the mama bear showed its ear was tagged with No. 51, indicating she’s had previous contact with state wildlife wardens.

The bears’ visit was first reported by the San Gabriel Valley Tribune, which reported that Oak Knoll Montessori School, which shares the campus, was also locked down.

The K-8 school is on the campus of Pasadena Unified’s now-shuttered Loma Alta Elementary, on Canon Boulevard off Loma Alta Drive. The school is a few blocks from a popular trailhead that leads into the San Gabriel Mountains.

KTLA’s Judy Oehling contributed to this article.