Four people were injured Monday when a tree branch struck a Six Flags Magic Mountain roller coaster, stranding 22 riders in the air for nearly three hours.

According to the Los Angeles Times, the branch fell onto the tracks of the Ninja ride before 6 p.m., derailing the first car and leaving it in a "precarious position." Fire officials said riders were suspended about 20-30 feet in the air, The Associated Press reported.

>> Read more trending stories

All 22 riders were rescued around 8:30 p.m., a park spokeswoman said.

"The black belt of roller coasters whips you into submission. . ... As you shoot down the snake-like steel track, you'll grip the hillsides and blast through the trees swiftly, slicing through the landscape. Ninja pivots with precision as you narrowly miss tagging land and water, whipping around at 55 miles per hour," Magic Mountain's website says of the roller coaster.

Check out some dramatic photos of the rescue below.