A Somali refugee who was convicted of sexually assaulting a child has been awarded £105,000 damages for his unlawful immigration detention.
The 41-year-old man, only identified as AXD, is still serving a 21-month sentence for the crime imposed in February 2015.
AXD, who arrived in the UK in 1997 and has also served a 16-month sentence for unlawful wounding after slashing his victim's face with a broken mirror, brought his detention claim against the Home Office.
At London's High Court in May, Mr Justice Jay ruled that AXD, who is probably schizophrenic, was unlawfully detained for 20 months and five days from April 1 2013 to December 5 2014.
He said that AXD was "not a particularly worthy, likeable or sympathetic individual".
"Another way of looking at this case, however, is to point out that the claimant is vulnerable, that he probably suffers from paranoid schizophrenia, and that only those obligated to an adherence to the rule of law would be likely to vindicate his rights.
"This alternative viewpoint is based not on any subjective preferences but on the loyal discharge of the judicial function."
AXD was detained on August 27 2009 following the completion of his unlawful wounding sentence and his detention up to May 17 2011 was not unlawful, said the judge.
He was re-detained on November 27 2011 after completing another custodial sentence and was unconditionally released on December 5 2014 before being granted refugee status in August 2015.
While detained, AXD argued that if he was deported he would face persecution on account of his sexual orientation and his conversion from Islam to Christianity. Concerns were also raised about his mental health.
The judge said that AXD had been detained far too long in circumstances where he was not obviously "playing the system" and his deportation to Somalia could best be described as speculative.
The risk to the public, and of absconding, was not so great that continued incarceration was the only real option.
"In my judgment, the claimant's case cried out to be grabbed by the metaphorical scruff of the neck, and clear and firm decisions made.
"It is simply not acceptable that the claimant was detained for so long, in such circumstances."
On Tuesday, he said that the appropriate compensatory award was £80,000 plus £25,000 to reflect the aggravating features of the case. There will also be interest of £3,528.