A man hijacked a school bus with 51 students aboard before setting the vehicle ablaze in an apparent protest over Italy's migration policy, police said.

The children were getting off the bus as the fire was started and although some youngsters were hospitalised no-one was reported to have been seriously injured.

"San Donato police have arrested the driver of a middle school bus. He had taken 51 students. He was stopped after ramming three patrol cars. During the descent of the children from the vehicle, he set the bus on fire," said a tweet by the Carabinieri.

Police spokesman Marco Palmieri said the driver — 47-year-old Ousseynou Sy, a Senegalese with Italian citizenship — told officers after he was arrested: “Stop the deaths at sea, I'll carry out a massacre."

At a Thursday press conference, Alberto Nobili, head of the counter-terrorism at Milan public prosecutor's office, said the driver had no links with Islamic terrorism and "acted as a lone wolf".

Nobili added that Sy had been planning the kidnapping for awhile and "wanted the whole world talking about this story."

Sy allegedly posted a video on YouTube explaining his actions and called on relatives in Italy and Senegal to act, saying "Africa — arise".

One of the children told reporters at the scene the driver had threatened to pour petrol on them and set them alight. One of them managed to call the police who rushed to the scene and were able to rescue the children.

A teacher that was on the bus with the children, said it wasn't the first time this man drove a school bus with children inside.

"We knew him," the teacher told Ansa news agency, adding he was angry about the government's migrant policy.

According to the teacher, the man was driving the bus to a runway at Milan's Linate airport.

A girl interviewed by Ansa said the man kept repeating that "people in Africa are dying and that it was the fault of Di Maio and Salvini".

On Tuesday, Italy's deputy prime minister Matteo Salvini reiterated Italy's ports are closed to migrant rescue boats after an NGO ship asked to dock.

After the incident, Salvini tweeted that police were searching the man's house and that he wanted to know why a man with his antecedents — he allegedly was charged with drunk driving and sexual harassment — was allowed to drive a school bus.

He also said that Sy's Italian citizenship could be revoked if convicted of terror under a new security decree put in place last year.

Italy's Ministry of Defence thanked the police for saving the children in time.