A branch fell onto the Ninja roller coaster track shortly before 6 p.m., Six Flags representative Sue Carpenter said. Eleven of 22 people were stuck on the ride, with four people in the front car, which was derailed.
The four people up front had minor injuries, according to an L.A. County Fire inspector. The park said the injured riders were transported to a local hospital for precautionary measures. They have since been treated and released. Among those hurt, one person suffered a knee injury, and another person had a neck injury.
The rescue operation was expected to last until about 10 p.m., but the final two riders were rescued at about 8:40 p.m.
An L.A. County Sheriff's station is located inside the park, and deputies were able to respond immediately. The L.A. County Fire Department was called, and urban search-and-rescue personnel responded. Mechanics and special tools were utilized in the rescue effort. Firefighters used a "cherry-picker" lift to raise firefighters into position to pull riders off one by one.
Rescuers put chains around the derailed car to protect it from falling off while the rescue was in progress, according to the fire department. All riders were alert, conscious and talking, Carpenter said.
The park remained open and other rides were in operation during the rescue effort.
The incident was under investigation by the county sheriff's and fire departments.
"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," the park said in a statement.
PHOTOS: Riders stuck on Magic Mountain roller coaster