TAIPEI (Reuters) - Eighteen people died and 175 were injured when a train derailed in northeastern Taiwan on Sunday, authorities said, in the island's worst rail disaster in more than three decades.

Four carriages overturned in the crash, which occurred in Yilan County near the coast on a line popular among tourists when all eight cars ran off the tracks on a bend near a station, officials said.

It was unclear what caused the crash. As of 9:35 p.m. (1335 GMT), all 366 passengers onboard - including the dead and injured - had been evacuated or removed from the wreckage, the Taiwan Railways Administration said.

"The train was going very fast. I thought to myself: Why was it not slowing down on a curve?" 30-year-old Henry Tseng, who was onboard one of the overturned carriages and suffered eye injuries, told Reuters.

"I hit a wall when the car started to flip. Around five to six people were thrown out of the carriage door...There's no time to think what happened. Everyone was in a rush to get out," he added.

Hundreds of rescuers and military personnel worked through the wreckage with spotlights on Sunday night in search of survivors, with ambulances stationed nearby.

Rescue workers, some attending to injured people at the scene, used cranes to lift the battered cars, some of which were lined in a zigzag pattern near the tracks.

"Check there, check there," several rescuers shouted while lifting a deformed car with a crane to look for survivors. Some rescuers climbed onto the top of an overturned carriage which had hit a pole carrying electricity.

The official Central News Agency said the incident was the island's deadliest rail tragedy since 30 were killed in a 1981 collision in northern Taiwan.

"It's terrifying. I really did not know how it happened. After a scene of terror, the train flipped, the seats were broken and suitcases were all over the place," a seventh-grader with the surname Yang told the news agency.

INVESTIGATION UNDERWAY

"We need to get some water in quickly," a woman was seen shouting in a live broadcast on Facebook shortly after the crush in the late afternoon. Several passengers, who appeared to be suffering from minor injuries, were carried out from a deformed car by local villagers before rescuers arrived, the video showed.

"We will use all our strength and efforts for the rescue," President Tsai Ing-wen wrote on her Facebook page.

An investigation was under way to find out the cause of the crash, Taiwan Railways Administration said. "The train was in pretty good condition," its Deputy Chief Lu Chieh-Shen told a news conference.

An American citizen was injured. The authority was checking whether more foreigners were on board.

The derailment came weeks ahead of island-wide local elections that are being seen as a bellwether for Tsai's ruling party's performance in presidential elections due in 2020.

(Reporting by Jess Macy Yu, Yimou Lee, Lee Kun Han and Taipei bureau; Editing by David Goodman, Dale Hudson and Kirsten Donovan)