A roller coaster at Six Flags Magic Mountain in Valencia, California, remained closed Tuesday after a tree branch fell on the track partly derailing the train and leaving riders suspended about 40 feet above the ground for more than two hours Monday afternoon.

Rescuers brought in heavy equipment to free 22 passengers, including four who suffered injuries, on the Ninja ride located on the side of a hill, Los Angeles County fire officials said.

Firefighters were called to the amusement park just before 6 p.m. after the branch fell across the tracks, slamming onto the front right corner of the first car. Aerial video showed fire-rescue personnel helping rider from the coaster, a process that did not end until about sunset.

Two riders were taken to the hospital to be checked out. One had neck pain and the other had knee pain, officials said. Another two were also transported for treatment.

All four people had been treated and released as of Tuesday morning, according to a statement by Six Flags Magic Mountain.

According to the Six Flags website, Ninja takes riders on a winding track at speeds of 55 mph. Riders hang from the track and are swung 90 degrees each way.

Ninja, which opened in 1988, is approximately 2,700 feet long. It holds 28 riders at a time.

"The safety of our guests and employees is our number one priority and as a precaution, the ride will remain closed until a thorough inspection of the area is complete," park officials said in a statement.

It is unclear how long the temporary closure will last.

Jane Yamamoto, Toni Guinyard and Samia Khan contributed to this report.

