TAIPEI, Taiwan – The train, which entered and exited the mountain tunnels along Taiwan’s east coast, was full of people rushing to see family and friends on the first day of a long weekend vacation.

Then, according to the survivors, it was rocked by a serious crash, flew off the rails and slammed against the walls of a tunnel.

The derailment of the eight-car Taroko Express train on Friday morning was the worst such disaster in Taiwan in four decades. At least 51 people, including two train drivers, were killed and around 150 others injured, the authorities said.

Investigators are still trying to find out why the train crashed while traveling from near Taipei to the eastern coastal city of Taitung. However, initial reports indicated that it had either collided with a construction vehicle rolling down a slope onto the track, or was hit by the falling truck as it passed.

By Friday evening, rescue workers had rescued dozens of passengers trapped in the rubble but struggling to get to several wagons deep in the tunnel. Local news showed a worker using an electric circular saw to cut through one of the twisted wagons.

Video footage posted online showed rescuers carrying injured passengers on stretchers as other survivors came out of the tunnel and walked on the roofs of the train carriages, some rolling suitcases. Several passengers described how they smashed the windows of the cars with their luggage in order to escape.

A passenger surnamed Wu told Taiwan’s official news agency that the last thing he remembered before he passed out was a loud crash. When he came to, the train was shrouded in darkness and he and several passengers used the light on their cell phones to see. They tried to help the other injured survivors, he said, but it took them an hour to find their way off the train.

“I’m safe, but I didn’t dare see the crash scene,” he said. “There were a lot of corpses there.”

The crash occurred around 9:30 a.m. in a tunnel north of Hualien City near Qingshui Cliff, a destination popular with tourists who flock to see towering mountains and crystal blue waters. Friday was the annual Tomb Sweeping Day, a time Taiwanese travel a lot. A rail official told Taiwan’s United Daily News that the train had 374 seats and was almost full.

The Taroko Express is one of the fastest to cross Taiwan’s east coast and typically travels at 80 miles per hour. In interviews with local news outlets, survivors described the train as overcrowded, with many passengers standing along the way. Some said in video interviews that the cars they were in were filled with smoke and that they could see passengers who were unconscious and trapped.

The death toll makes the train wreck one of the worst disasters Taiwan’s President Tsai Ing-wen has faced since taking office in 2016. Within hours of the crash, Ms. Tsai said the government had fully mobilized emergency services. She later vowed to conduct a thorough investigation into the cause of the collision.

“We pray that the victims rest in peace and that the injured recover as quickly as possible,” she said at a press conference on Friday afternoon.

In the last major train accident in 2018, 18 people were killed and 170 others injured after a train derailed on a coastal route popular with tourists in northeast Taiwan’s Yilan County. Taiwanese investigators later found that the train was traveling too fast and the driver manually deactivated a System designed to prevent safe speeds from being exceeded.

Train accidents are still quite rare in Taiwan. The last crash of a similar magnitude occurred in 1981 when 31 people were killed in a train collision in the northwest of the island.

A rail official said they believed the construction vehicle driver was parked on a slope near the tunnel entrance and may have forgotten to use the emergency brake, causing the truck to roll off and hit the train as it passed the Central News Agency. The driver is not believed to be in the truck at the time.

A cell phone video filmed of a passenger and posted on social media showed a yellow tag lying on its side next to the derailed train at the entrance to the tunnel.

“Our train crashed into this truck,” said the passenger in the video. He panned the camera and showed a grassy slope near the tunnel. “The truck rolled down and now the whole train is twisted.” Local media posted a photo showing a single truck door lying in the grass.

The police picked up the operator of the construction vehicle for questioning, according to a telephone police officer in Hualien County.

Lin Chia-lung, Taiwan’s Minister of Transportation, told reporters at the crash site on Friday Although he had done his best to strengthen accountability and reform the rail system after the 2018 disaster, “the pace and results of the reforms were clearly insufficient.”

“I am responsible and I should take responsibility,” said Mr. Lin.

Wei Yu-ling, general secretary of the Taiwan Rail Union, said in an interview that she expected the government to conduct a thorough investigation into Friday’s crash, which occurred not long after a maintenance train hit and killed two railroad workers and injured another one inside Taitung is a county in eastern Taiwan.

The recent accidents, she said, “exposed the internal problems of the Taiwanese railway administration from top to bottom.”

Photos of Friday’s online crash showed the damage was severe. A picture from United Daily News, a Taiwanese news agency, showed the train’s apparently mangled control car on its side in the dark tunnel. The train conductor told a local TV station that he was at one end of the train when he felt the emergency brakes apply and a sudden jolt occurred.

“A lot of people were stuck under chairs and piles of bodies,” a woman surnamed Wu told ET Today, a Taiwanese news broadcaster, in a television interview from the hospital where she was treated for minor injuries. “At first I could hear them screaming for help, but then maybe they fell asleep or something. I’ve seen a lot of children too, so pathetic, so pathetic. “

Most of the train traffic on Taiwan’s eastern lines was suspended until Sunday morning, causing delays for many at the start of a long holiday weekend. Tomb Sweeping Day, an ancient Chinese festival also known as Qingming, is a time when the living pay respect to their ancestors by cleaning up their graves and burning paper offerings.

A woman who was traveling home with her husband to sweep the family graves in Taitung told local reporters at the scene of the accident that she was sleeping in the seventh car when the train crashed and knocked her to the ground. The woman’s shirt was bloody and a plaid scarf had been tied around her head to keep the bleeding low.

“We always tried to take the train whenever we could,” she said as rescue workers wearing yellow hard hats worked behind her. “We never thought something like this would happen.”

Joy Dong reported from Hong Kong.