Leaked cabinet letters suggest that the Home Office - when it was being run by Theresa May - wanted the children of illegal immigrants to go to the bottom of the list for school places.

Her department suggested schools could withdraw places offered to children if their families were found to be living in the country illegally.

The Home Office also wanted schools to carry out immigration checks.

Shadow education secretary Angela Rayner said the plan was "disgusting".

'Not government policy'

Chief Inspector of schools Sir Michael Wilshaw said he was "amazed and shocked" by the claim - while Liberal Democrat education spokesman John Pugh dismissed it as "a grubby little idea".

But immigration minister Robert Goodwill insisted that deprioritising school places for children of people in the UK illegally is "not the policy of the government".

The government said it would not comment on leaked documents, but added that it was right that a range of options would be considered before ministers made a final decision.

By law, children under 16 have a right to an education whatever their parents' circumstances.

But the documents suggested the Home Office wanted schools to ask to see passports before accepting new pupils.

'Dipped in blood'

In summer 2015, Theresa May wanted Whitehall departments to contribute to the government's ambition to reduce immigration to the tens of thousands.

One source says every department was to have its hands "dipped in blood". But the letters reveal there was a "disquiet among our own ministers about the potential for inflammatory comparisons" by using schools as part of the immigration system, punishing the children of illegal immigrants by putting them to the bottom of the list for school places.

After discussions at a cabinet committee, Nicky Morgan, then education secretary, wrote twice to the then Prime Minister David Cameron with "profound concerns" about the Home Office's plan for schools.

It is not clear how wide-ranging the plans were, but the Department of Education is only responsible for schools in England.

In her letter, Ms Morgan wrote: "I have concerns about the practical and presentational issues of applying our strong position on illegal migrants to the emotive issue of children's education.

"These cover deprioritising illegal migrants in the schools admissions process, and carrying out immigration checks through schools."

The Department of Education was also concerned about how immigration checks would disrupt the school admissions process.

Image copyright Getty Images Image caption Concerns were raised about some of the Home Office's plans under Theresa May

Ms Morgan wrote that "the checks would need to be processed and verified in time to make any changes (ie withdrawing a place from an illegal migrant and giving that place to another child) before the start of the school term.

"This would destabilise the admissions process - already the subject of considerable media scrutiny and political pressure - for example delaying schools from being able to confirm British and legal migrants' children's place in good time before the start of the school year."

The education department was also worried about the measure worsening segregation, suggesting: "The overall effect of a deprioritisation measure would be to concentrate children of illegal migrants in the least popular schools in any area, jeopardising our increasingly important focus on tackling both segregation and extremism, and with consequent impacts on the children of British nationals who attend the schools.

"Aside from the impact on ordinary parents, there is also a risk to children's safety.

Image copyright PA Image caption Nicky Morgan was education secretary under David Cameron

"Introducing these checks could lead to some children not being registered for school because of real or perceived fear of deportation.

"Leaving aside the fact that these young people will not receive a decent education, this is a safeguarding risk - we have real concerns that children out of school may be at greater risk of radicalisation or other harms."

Ms Morgan also warned David Cameron that the Home Office policy "would reinforce negative stereotypes of our party... squandering the unprecedented opportunity to capture the centre ground, that the election of Jeremy Corbyn has given us".

The measures were dropped from the Immigration Bill, with Mrs May understood to be furious.

But one Conservative source familiar with the discussions said: "It was one of those moments when the desire to control immigration comes up against real people's lives and our values."

A government statement said: "It is only right that any government looks at a range of options when considering policy options, but ultimately it is for ministers to decide which policies are taken forward.

"We are building a system that works in the best interests of the British people and ensures that only those with a right to be in the UK can live and work here.

"We do not comment on leaked documents."

'Terrible idea'

But Labour frontbencher Ms Rayner claimed the documents provided evidence that Mrs May had tried to "offload" the failure of the Home Office to cut immigration by trying to make teachers perform border control functions.

She told BBC Radio 4's Today: "I think it's a terrible idea. Denying innocent children because of the circumstances of their parents the right to a good education is disgusting - it's not a British value that we have.

"And of course, one in eight UK nationals don't have a passport either, so it's completely impractical."

Sir Michael Wilshaw, who is about to end his term as chief inspector of schools, added: "I'm amazed by it and shocked by it. Schools shouldn't be used for border control - that's the job of the border agencies.

"Schools have got enough to do raise standards than to worry about who they are taking in and whether they've got a passport."

Lib Dem John Pugh said: "There is just so much wrong with this grubby little idea, not least that schools are not a second line border force, they are for education.

"This shows how the Home Office under Theresa May tried everything it could to forage around in the gutter for a few votes and couple of cheap headlines. Leaving children uneducated would do a lot of harm and is short-sighted."