The Home Office has failed in a legal bid to deport a Somalian double rapist who subjected four women to violent sex attacks in Scotland.

Abdalla Ali Hemed, 52, was found guilty at the High Court in Glasgow in 2008 of two counts of rape and two sexual assaults with intent to rape. He was jailed for nine years for the attacks.

Then-home secretary Theresa May launched a legal bid in 2013 to have Hemed removed from the UK.

He launched an appeal and won on the grounds that he would be in danger if he was returned to Somalia because he is from the Bajuni minority ethnic group.

The Home Office then launched a legal challenge against the ruling but judges at the Court of Session in Edinburgh this week ruled in favour of the sex offender again and refused the appeal.

The refugee came to the UK on a false passport in 2002 and was granted leave to stay in Scotland after fleeing the military regime on Somalia.

In 2004, Hemed and a gang of men subjected his first victim to serious sexual assault in a flat in Aberdeen then raped another woman at knifepoint at his flat in the city in 2006 after giving her drugs.

Later the same year, he launched a sex attack on another woman at his flat and did the same less than a week later.

At the time of his conviction, the Home Office wrote to Hemed saying he would be deported because he had been convicted of a "particularly serious crime and constituted a danger to the community of the United Kingdom".

He was then told in October 2014 his refugee status had been "cancelled" but he was allowed to remain in Britain under the European Convention on Human Rights.

Judge Lord Carloway issued a judgment this week on the Home Office's appeal against the previous ruling.

He refused the appeal, stating that the "respondent (Hemed) could not realistically be expected to relocate to Mogadishu, from his home state of Kismayo, was one of fact which was reached on the basis of country guidance on Mogadishu and the respondent's particular circumstances".

Lord Carloway added: "There was no error of law in carrying out that exercise. The appeal must be refused."