Updated

Four people were injured and 18 others were stranded at least 20 feet in the air for over three hours after a roller coaster at a southern California amusement park struck a tree branch Monday evening.

The Ninja roller coaster at the Six Flags Magic Mountain park was abruptly halted when the accident occurred at around 5:30 p.m. local time, Los Angeles County Fire Department dispatch supervisor Michael Pittman told The Associated Press. Firefighters confirmed that the last riders had been removed from the roller coaster shortly after 9 p.m. local time.

Two of the four injured people were taken to a local hospital, but fire and park officials said all the injuries were minor.

"We were going across one turn and all of a sudden a loud noise happened," Jeremy Ead, one of the injured riders, told KCAL-TV. "I ducked down just in time. A hard branch hit me in the head. I was there bleeding from my head, which was a little worse than this," he said, pointing to a gash in his forehead.

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.

Firefighters and park maintenance workers in harnesses could be seen removing the riders one by one from coaster cars. Others waited patiently, some talking with each other and others resting with their eyes occasionally closed.

All were alert and communicated with park staff during the evacuation process, Six Flags said in a statement.

The ride would remain shut down while the accident was investigated, park spokeswoman Sue Carpenter said in a statement.

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

The accident comes nearly a year after a woman was ejected from a roller coaster at Six Flags Over Texas in Arlington and died. The death was ruled an accident, but her family has sued both Six Flags and the German company that built the coaster's trains, both of whom denied any wrongdoing.

In September 2012 at another Southern California amusement park, Knott's Berry Farm, riders were left dangling at 300 feet for more than three hours when its Windseeker ride broke down. No one was injured in that breakdown.

The Associated Press contributed to this report.

Click for more from MyFoxLA.com.