A roller coaster derailed after striking a fallen tree branch at the Six Flags Magic Mountain amusement park north of Los Angeles Monday, causing injuries and leaving many of the riders stuck for about three hours.

One by one, firefighters wearing harnesses and park maintenance workers removed all of the people stranded aboard the Ninja coaster, dangling about 20 feet in the air.

Four people on the ride received minor injuries, Michael Pittman, a fire dispatch supervisor, said.

Kevin Takumi, a helicopter photographer, posted photos on Twitter that showed people trapped in their seats in the ride as emergency responders struggled to free them.

Televised news reports showed at least one of the cars that normally are suspended beneath a track dangling at an angle, derailed at the front.

The Ninja coaster has a capacity of 28 riders.

"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," according to the amusement park's website.

Six Flags Magic Mountain is in the Valencia area of Santa Clarita, in northern Los Angeles County.