The wreckage of a bus that was set ablaze by its driver in protest against the treatment of migrants trying to cross the Mediterranean Sea, is seen on a road in Milan, Italy, March 20, 2019. Photo: Local Team via Reuters TV/Reuters.

Rome - The driver of a school bus in northern Italy set fire to the vehicle on Wednesday, but the 51 pupils who were on board escaped with no serious injuries.

The incident, involving children aged around 12, unfolded on a suburban highway in San Donato Milanese, a municipality in the south-eastern outskirts of Milan.

"We were all very scared," one boy, interviewed anonymously by La Repubblica newspaper, said. 

"He tied us all up and seized all mobile phones so that we could not call the police."

However, one mobile fell on the floor. The boy, deemed a "hero" by La Repubblica, used it to call the police after managing to untie his hands.

A police chase ensued, at the end of which the bus crashed. Officers forced open the back door and helped students off the bus, while the driver, an Italian with Senegalese origins, threatened suicide.

He was arrested after setting the bus on fire, which he had previously doused with petrol. Video footage showed that the vehicle was completely gutted by flames.

The man's motives are unclear, and prosecutors are not ruling out terrorism. 

"Yes, we are considering all hypotheses," Milan anti-terrorism prosecutor Alberto Nobili told dpa.

"I want to end it all, we need to stop [migrant] deaths in the Mediterranean," the driver said, according to RAI public television and other media reports.

"He wanted revenge for his daughters" who died at sea while trying to reach Italy, said another boy from the bus, according to a video posted by Agenzia Vista.

"He wanted revenge for his three daughters and to kill us," he said.

A spokesperson for emergency services said 23 people were treated in hospital for minor injuries. La Repubblica said people suffered bruises and early symptoms of smoke inhalation.

"The important thing is that, thanks to the courage of the children ... an event that could have had a tragic outcome had a happy ending," Carabinieri police commander Luca De Marchis said.

The ANSA news agency carried the commander's remarks. He said the bus driver, who was not armed, faces kidnapping and attempted mass murder charges.

"We wanted to interrogate him immediately but he has burns on one arm," Milan chief prosecutor Francesco Greco told journalists, according to ANSA.

Interior Minister Matteo Salvini said the man had a criminal record for drink driving and sexual assault, and suggested he was unfit to work as a school bus driver.

"I want to get to the bottom of this," he tweeted.

dpa