Tobolsk Prison Castle
Foreign criminals could be allowed to stay if their children were born in the UK Alexander Aksakov/Getty Images

An EU court has told the UK that it may not be able to deport a Moroccan criminal whose one-year jail sentence has come to an end because it would deprive her children's rights as a European citizen. The decision is seen as a major blow to Theresa May's Home Office and David Cameron's EU reform deal

Advocate general Maciej Szpunar told the UK government that the woman, known only as CS, should be allowed to stay in the UK despite being jailed in 2012. The hearing took place in Europe's highest court and could potentially mean that hundreds of criminals in the UK's prison system could claim to remain in the country after completing their sentences. Szpunar said that offenders whose children have UK citizenship cannot be deported just because they have committed a crime.

Currently UK law says the Home Secretary is obliged to automatically deport all non-EU offenders who are sentenced to more than one year in prison, and that family circumstances are irrelevant. Any final ruling that CS should stay would contradict UK's law.

The case raises questions about the UK's sovereignty when faced with EU laws and directives that has led to Tory Eurosceptic MPs, such as Boris Johnson, questioning Cameron's latest EU reform deal. In response to Johnson, the prime minister has said that he will underpin the reform deal with legislation that will "put beyond doubt" the UK's sovereignty.

According to the Telegraph, the Home Secretary must weigh up whether each convict presents a "genuine, present and sufficiently serious" threat to society. And the test must include judging their health, economic circumstances and likelihood of reoffending.

The woman was convicted of trying to smuggle a SIM card into a prison and when her sentence was over her asylum application was turned down in 2013. Her case went before an immigration tribunal which ruled in her favour.

The UK appealed this ruling decision and the case was sent to the Luxembourg court. The court is yet to decide on whether or not she will be allowed to stay in the UK or will be allowed to be deported.

Philip Hollobone, the Conservative MP for Kettering, told the Times: "This is yet another crazy judicial ruling and underlines the need for us to leave the EU and to abolish the human rights act. By being a member of the EU and having the human rights act, we are effectively unable to decide which people we want in the country."

In his assessment of EU law on the subject, Szpunar said the current UK law of automatic deportation is a violation of European laws. And there was a chance that expelling CS could "deprive the child who is a citizen of the Union of genuine enjoyment of the substance of his or her rights."

He did say, however, parents can be deported in "exceptional circumstances", after the government has examined the "personal conduct" of the criminal and whether they present a serious risk to "public security".