Four people were injured and about two dozen riders were stranded for nearly three hours after an accident on the Ninja roller coaster at the Six Flags Magic Mountain amusement park in Valencia, California, on Monday.

The accident took place when the roller coaster hit a fallen tree branch on the track, derailing the front car. Authorities reportedly were forced to stop the ride, leaving 22 people stranded about 20 feet above the ground for hours. All the riders have since been rescued, media reports said, citing the Los Angeles County Fire Department dispatch supervisor. Firefighters and park maintenance workers helped in the rescue mission, and reportedly used lifts and ladders to bring the riders down.

Magic Mountain spokeswoman Sue Carpenter reportedly said that two riders were "transported to a local hospital for precautionary measures," while another two had minor injuries.

The people on the ride were "all alert and corresponding with park personnel during the evacuation process," Carpenter reportedly said, in a statement. She also added that the ride, which is known as “The Black Belt of Roller Coasters,” will remain closed until a “thorough inspection of the area is complete.”

The Six Flags website described the ride as “a suspended swinging roller coaster.”

“As you shoot down the snake-like steel track you’ll grip the hillsides, slicing through the landscape. Ninja pivots with precision as you narrowly miss tagging land and water, whipping around at 55 miles per hour,” according to the ride’s online description.

Six Flags Magic Mountain is located in the Valencia area of Santa Clarita, about 25 miles north of Los Angeles.

Here is a 57-seconds video showing the rescue operation.