This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

(KTLA) – Firefighters in California rescued a bear that got trapped in a back lot at Six Flags Magic Mountain last week, authorities said.

The bear wandered onto the lot at the Valencia amusement park on May 5 and somehow got stuck between two cargo trailers, according to the Los Angeles County Fire Department.

A Fire Department crew arrived at the scene, along with officers from the California Department of Fish and Wildlife and animal control.

“They worked diligently and patiently for the next several hours to free the bear,” the Fire Department said in a news release.

Members of the L.A. County Fire Department work to rescue a bear that became trapped at Six Flags Magic Mountain. (Los Angeles County Fire Department)

After the bear was sedated, firefighters used equipment to move one of the trailers to get to the animal.

Images shared by the Fire Department showed the sedated bear being prepared for transportation.

Fire officials said the animal was safely relocated by personnel from the California Department of Fish and Wildlife.