Terrified passengers called emergency services just before 6pm on Thursday and he was arrested by armed police as soon as he stepped off the Ave train at Girona station 20 minutes later.
The Catalan police force, Mossos d'esquadra, had evacuated the station but quickly established that the suspect was not in fact carrying any explosives and announced it was a false alarm.
Falsa alarma per 1 suposada bomba en 1 tren que anava d BCN a Girona. A la capital gironina hem detingut l'home que amenaçava en esclatar-la— Mossos (@mossos) March 2, 2017
False alarm over a supposed bomb threat on a train from Barcelona to Girona. The man who threatened to explode it has been arrested in the Girona capital - tweet from Catalan police force.
The train was given the all-clear to continue after being swept for explosives by sniffer dogs.
Police confirmed that the suspect was a 30 year-old Moroccan and said he was not carrying any ID at the time. He is currently in police custody.
Police chief Xavier Domènechsaid that causing a panic with a false threat was also a crime and that the suspect would be evaluated by doctors to determine whether he suffered mental illness.
Spain raised its terror alert to category four on a five-point scale since June 2015, the highest since the Madrid train bombings in 2006, after a shooting attack at the beach resort of Sousse in Tunisia left 38 people dead.
While Spain does not see an imminent threat from an organized cell or group, recent events in Europe have raised concern about “lone wolf” attacks such as have been seen in Nice and Berlin.
Spain has been mentioned on extremist websites as a possible attack target for historical reasons, given much of its territory was under Muslim rule from 711 to 1492.
Unlike France or Belgium, the country is less exposed to the risk of return of radicalised nationals who went to fight abroad and plan to commit extremist acts on home soil.
Only around 200 Spaniards are estimated to have gone abroad to fight, compared to thousands from nearby France and Belgium.