Justice Phillip Mott has ruled that taxpayers should hand £27,000 to an illegal migrant convicted for attempted rape because he was held in immigration detention for too long while the authorities tried unsuccessfully to deport him.

Bashdar Abdulla Qarani entered the UK illegally in 2005 and acquired a laundry list of convictions for battery, carrying a knife, and theft prior to the rape attempt which finally prompted the government’s deportation bid, reports The Sun.

He received a four-year sentence for his crime and was released after two, but placed in immigration detention while the Home Office attempted to remove him from the country.

After two years, Qarani was released. He had no documents and would not confirm his country of origin which, under the current rules, leaves the government helpless.

Deputy High Court judge Philip Mott QC ruled the authorities should have realised they would fail to deport Qarani sooner, and that 11 months of the time the sex attacker spent in prison were a breach of his human rights.

The Outer Temple Chambers barrister decided Qarani was entitled to a £27,000 payout for his troubles. His victim, according to The Sun, will have been eligible for just £7,500.

Rape survivors’ charity Voice4Victims said that Mott’s judgement highlighted the “imbalance” in the judiciary’s sympathy for abusers as compared with their sympathy for victims.

Mott has made similar judgements in the past, ruling that a crack and heroin dealer named Paul Ricky West should be compensated for spending time in detention while the Home Office attempted to establish whether he was from Ghana or Jamaica.

West was given a four and a half year sentence for his crimes, reduced to just one year on appeal. West was entitled to parole halfway through this sentence, however, as is now standard, and sued the government for keeping him in immigration detention from 27 August 2007 to 14 January 2010 whilst they tried to deport them.

As West had no documents and was not forthcoming in helping the authorities establish his country of origin, he eventually had to be released, but Mott ruled that this should have been done sooner.

Mott also ruled that a Sudanese paedophile who entered the UK illegally could not be deported for fear he may face “persecution” in 2013.

On this occasion, Mott refused Jumaa Kater Saleh’s demand to be compensated for the time he spent in immigration detention, but the Court of Appeal overturned this relatively strict ruling.