Mustafa Abdullahi, 31, was jailed for ten years after he threatened to kill his victim and repeatedly assaulted her.
He was set to be deported on release, but immigration judges have ruled he cannot be kicked out because his mother and other family members live in the UK.
They said he had been here so long, it would breach his right to a private and family life to force him to return to Somalia.
The judges also gave him credit for having ‘faced up to what he has done’ and having put his criminal behaviour ‘behind him’.
They also concluded he posed a ‘low risk’ of committing further offences, based on evidence from a psychiatrist who only saw him for a couple of hours.
The case is the latest in a series of human rights judgments in which judges favour the rights of criminals over those of victims and the wider public.
Tory MP Dominic Raab said: ‘This vicious man should be on the first plane back to Somalia.
It makes a mockery of British justice and human rights to see such a dangerous thug dance rings around the UK system.’
Abdullahi came to Britain aged 11 in February 1993 to join his mother, brother and sister, who arrived three years earlier. They were all given indefinite leave to stay in 2000.
But in 2007 he was sentenced to ten years in prison for the horrific sex attack, in which he repeatedly raped a ‘vulnerable’ pregnant woman in her early twenties who had been sleeping at her home, after holding a knife to her throat and threatening to kill her.
Despite the evidence against him he refused to accept his guilt, forcing his victim to go through the ordeal of a trial.
Even while in jail he refused to admit what he had done.
When the Home Office began efforts to deport him, he immediately claimed asylum.
This application was rejected last year, by which time he was out of prison after serving half his sentence. But Abdullahi’s lawyers appealed against his deportation on human rights grounds.
Earlier this year, a Home Office lawyer told a tribunal Abdullahi should be deported because of the ‘very serious and disgusting nature of his offence’.
The Home Office pointed out that even after he was released from prison he continued to show ‘no respect for the law’.
For example, while on probation, he was caught using cannabis but instead of being returned to jail, he was given a £60 fine.
Abdullahi said he was ‘afraid’ to return to the Somaliland region because of the civil war.
He claimed that he wasn’t a practising Muslim, despite having ‘Allah’ tattooed in Arabic on his arm and chest.
And because his parents had never taught him about the clan structure in Somalia, he would also struggle to fit in, he said.
The tribunal accepted that because he had tattoos, which are considered un-Islamic in Muslim countries, he would be ‘vulnerable to serious harassment’, but concluded it was safe for him to return.
However, they then allowed him to stay because of his right to a private and family life under Article 8 of the Human Rights Act.
Despite not having any children or a wife in Britain, they said it would be wrong to send him home because of the length of time he has lived in Britain.
The judges also decided he could stay because of his ‘close relatives’ here and ‘very regular contact with his parent and siblings’.
First Tier Tribunal Judge Nadine Finch, sitting in London, said that even though he did not admit his guilt in prison, he had since owned up and completed a ‘victim empathy’ course while on probation.
She concluded it was ‘shame and fear that he would be disowned by his family’ that meant he did not confess at the time, and attributed his lack of candour to the fact that it was his first time in prison and that the offence was ‘against the sensibilities of his own community’.
Psychiatrist Dr Harriet Hunt-Grubbe said that Abdullahi would be ‘deprived of the emotional support of his mother and immediate family if deported to Somaliland’.
'We are extremely disappointed with the court’s decision and plan to appeal. Those who come to the UK must abide by our laws and if they do not we will seek to remove them' Home Office spokesman
After speaking to him for just two hours, she said there was only a low risk that he would commit serious sexual or violent crimes.
She said he was ‘depressed as a result of possibility of deportation and from witnessing his brother committing suicide’.
Sending him to Somalia would also increase his suicide risk because he would be unlikely to have access to the anti-depressants and therapy he receives on the NHS.
She concluded that he was a ‘well-loved member of his family and his friendship network and that his deportation would have a negative impact on their own lives’.
The Home Office appealed but this was rejected by an Upper Tribunal, which said: ‘Although he has committed serious offences, he has at last faced up to what he has done and has taken significant steps to put behind him that kind of criminal behaviour.’
Abdullahi, of Fulham, South West London, said: ‘I’m not commenting about the case.
You’ll have to speak to my solicitor.’ His aunt, Sali Abdullahi, said he did not want to go back to Somalia because he had ‘no family or friends there and it is dangerous’.
A Home Office spokesman said: ‘We are extremely disappointed with the court’s decision and plan to appeal.
‘Those who come to the UK must abide by our laws and if they do not we will seek to remove them.
In 2012 we removed more than 4,500 foreign national offenders.
‘For too long the Human Rights Act has been abused by foreign criminals to avoid deportation.
'That’s why we introduced tough new rules to protect the public that are being included in our Immigration Bill.’