The driver of a school bus has been arrested in Milan after allegedly hijacking the vehicle with 51 children onboard and setting it on fire.

One of the children called the police after the driver stopped the bus on a highway in the outskirts of the city, Italian media reported.

After police arrived, the suspect allegedly doused the vehicle with an inflammable liquid, reportedly shouting: “Nobody gets off here alive.”

The bus, which had been travelling from the city of Cremona in Lombardy, went up in flames but the police managed to get all the passengers off. Twelve children and two adults were taken to hospital suffering from smoke inhalation.

The suspect, a 47-year-old man from Senegal, is accused of arson and kidnapping. It is unclear what the motive for the alleged attack was, but he reportedly told police that he wanted to kill himself and “stop the deaths in the Mediterranean”.

The Ansa news agency reported that some of the children’s hands had been tied together with electric cables during an ordeal that lasted about 40 minutes.

Francesco Greco, Milan prosecutor, said: “It was a miracle they survived and we have to thank the police for that.”

Ansa reported that, before stopping the bus, the driver tried to ram through a roadblock. Police were carrying out investigations at the man’s home. He reportedly had previous convictions for drink driving and sexual assault.

Matteo Salvini, Italy’s far-right deputy prime minister, said: “At this moment the police are searching his home. I want to know why someone with similar precedents was driving a bus carrying children?”