The police had preliminarily ruled out terrorism as the cause of the attack on Thursday.

Taiwan police said on Friday that they arrested the man who set off explosives in a commuter train carriage at Songshan railway station.

The 55-year-old man, whose surname is Lin, is among the 25 people injured in the blast.

The police had preliminarily ruled out terrorism as the cause of the attack on Thursday.

Speaking at a press conference on Friday morning, Railway Police Bureau spokesman Wang Bao-zhang said police did not receive any intelligence before or after the train blast that suggested it was terrorism-related. Neither did anyone or any organisation claimed responsibility for the attack.

"While police found items that are related to explosives in a toilet of the train carriage, they cannot ascertain if those items are related to the blast," he told a press conference.

Wang, however, did not rule out the possibility that the attack might have been plotted by more than one person.

Thursday's blast in one of the carriages of a train that was travelling from Taipei to Keelung in northern Taiwan injured at least 25 people, with four in critical condition.

The police had stepped up security in Taiwan which had seen attacks on trains in the past by deranged persons.

Witnesses said they heard three blasts inside the sixth carriage before it burst into flames. They said they saw a man who walked in and left a bag in the cabin moments before the explosion.

Mr Wang also said that the blast happened when the train was one kilometre away from Songshan station. No detonator, however, has been found.

Premier Lin Chuan earlier told reporters: "It looks like somebody did this with a malicious intent and we will fully investigate this case."

A 20cm-long, black object was found on the train seat and the police and Taipei fire department said a “steel pipe”was the origin of the blast.

This is not the first attack on a train in Taiwan. Previous train blasts, including the most recent in 2013 on a high- speed rail train in Hsinchu, hurt one or two commuters.

In 2014, a college student killed four people in a stabbing spree on the Taipei metro, shocking the island and prompting a security overhaul of the city’s public transport systems.