22 people were stranded for almost three hours when a roller coaster derailed at Six Flags Magic Mountain in Valencia, California.

A tree branch fell onto the path of the Ninja roller coaster, causing the front car to detach from the tracks and dangle some 30 feet in the air.

Related: Check Out World's Tallest Water Slide POV Camera Here! 

The 22 passengers were safely evacuated by firefighters around 8:30 p.m. Monday night, Magic Mountain spokeswoman Sue Carpenter said. Two passengers sustained minor injuries and were taken to the hospital as a precautionary measure, according to Carpenter.

The ride will remain closed until a “thorough inspection of the area is complete,” Carpenter said.