A bus carrying 51 schoolchildren was hijacked by its driver and set alight near Milan in Italy.
The children, some of them tied up, were rescued through smashed windows at the back of the bus and no-one was badly hurt. Fourteen people suffered smoke inhalation.
The driver, a 47-year-old Italian citizen originally from Senegal, has been arrested.
"No-one will survive," the driver was alleged to have said.
"It was a miracle, it could have been a massacre," Milan chief prosecutor Francesco Greco was quoted as saying.
A teacher who had been on the bus said the suspect - named by police as Ousseynou Sy - was known to be angry about Italy's immigration policy and about the deaths of migrants in the Mediterranean.
"He shouted, 'Stop the deaths at sea, I'll carry out a massacre'," police spokesman Marco Palmieri said.
Prosecutors said the suspect faced charges of kidnapping, attempted mass murder, causing a fire and resisting arrest.
Mr Greco said officials were still weighing terrorism charges against him.
The suspect was known to police, having been previously convicted of assault and for driving while intoxicated, Alberto Nobili, head of counter-terrorism at the Milan public prosecutor's office, told a news conference.
How the drama started
Two classes of teenagers and their adult supervisors were being driven from a school in Vailati di Crema to a gym but the driver suddenly took a different route, apparently heading for Milan's Linate airport, reports said.
When the suspect began threatening passengers with a knife, a boy phoned his parents who alerted the police.
Officers then tried to intercept the bus. The vehicle rammed into police cars before slowing down.
Once the bus stopped, the driver jumped off and set it alight, having already doused it in petrol. Police were able to smash the rear windows and get passengers off before the vehicle was engulfed in flames.
"It was a miracle they [the children] survived and we have to thank the Carabinieri for that," Mr Greco said.
Interior ministry officials are investigating the possibility of annulling the driver's Italian citizenship, the AFP news agency reports.
A decree issued in September makes it easier to deport migrants and take away their citizenship if they commit serious crimes.
Italy's tough stance on migrants
Since coming into power in June, Italy's ruling right-wing League party and populist Five Star Movement have established a strong anti-immigration stance.
Located at the frontline of migrants crossing the Mediterranean Sea into Europe, Italy has tried to close its ports to boats.
On Tuesday, around 50 people were rescued by a charity ship from a rubber boat off the coast of Libya and taken to the island of Lampedusa. Italian authorities ordered that the ship be seized and launched an investigation into the alleged aiding of clandestine immigration.
Earlier this month, around 200,000 people attended an anti-racism march in Milan.