A convicted rapist and cocaine trafficker has won a legal challenge to have his deportation reconsidered after judges ruled it was "irrational" to conclude he posed a high risk of further sex and drug crimes.

Jamaican national Chan Wright was jailed for four years for a sex attack on a young mother committed the year after he arrived in Britain.

After his release from prison he was later jailed again for four months for being concerned in the supply of a Class A drug while he continued to live in Scotland and a sheriff recommended he be deported.

The Government decided to order Wright's compulsory removal from the country four years ago and his appeal against the ruling was dismissed by the Asylum and Immigration Tribunal in 2005.

But Wright (35) has now successfully challenged the tribunal decision before three judges at the Court of Session in Edinburgh.

Lord Johnston, sitting with Lord Eassie and Lord Wheatley, upheld his appeal and ruled that the tribunal should look at his case again.

The immigration tribunal earlier said: "It seems to us that in the period of about nine years between his arrival in the United Kingdom and the decision to make a deportation order he was convicted of two serious offences and of two minor offences."

"He spent almost three years in total of this nine year period in prison serving sentences imposed on him for the two serious offences."

It ruled: "Having regard to the frequency and seriousness of his convictions we are satisfied on the balance of probabilities that there is a high risk of him committing further offences in relation to sex, drugs or both."

But Lord Johnston said the judges were satisfied that the tribunal's conclusion was "irrational and not justified by a reasonable view of the evidence".

He said: "So far as sexual offences are concerned the appellant's record contains only one such offence, committed in 1995."

"While rape is of course a serious offence, the fact is that the conviction stands alone, with no suggestion of any other offence of a sexual nature having been committed," said Lord Johnston.

The judge said the drugs conviction had been a single event on one day and the description of it as "serious" did not sit happily with the penalty imposed on Wright.

Lord Johnston said: "In our opinion, when properly examined the evidence does not provide a basis upon which one could properly make a finding that there is a high risk of the appellant committing further sexual or drug offences."

He added: "Since it forms an essential element of the tribunal's determination we consider that that determination cannot stand."

Wright was given leave to enter the United Kingdom for six months in 1994, but the following year was granted an indefinite stay following his marriage to a British citizen.

But just months later he raped a 19-year-old woman at his then home in Graham Way, Livingston, in West Lothian, after inviting her in when he learnt she was looking for a phone.

When he made advances towards her the woman became alarmed, but Wright would not let her leave.

He was jailed for the offence in 1997 when the High Court in Edinburgh heard that the sex crime only came to light two days after the attack when the victim's boyfriend read what had happened in her diary.

The victim had rushed home sobbing after the rape, jumped into a bath still partly clothed and burned her underwear - but would not tell anyone what was wrong.

Wright's marriage, from which he had two children, broke down after his conviction for the sex attack.

The court heard that he subsequently formed another relationship with a woman student who became pregnant.

In 2003 he was jailed again for the drugs offence and the previous year was given community service for a breach of the Sex Offenders Act by not notifying police of his address.

Wright, of Huntly, Aberdeenshire, challenged the tribunal decision over his criminal record and because of compassionate circumstances relating to his children being in Britain and his relationship with his current partner Kate Swinney.

Miss Swinney had made it clear she was not prepared to go to Jamaica with him if he was deported.

Mungo Bovey QC, for Wright, argued that the tribunal finding that he posed a high risk of committing future sex and drug crimes was irrational based on the evidence.

He said the rape conviction was years old and no recommendation for deportation had been made at the time.

Mr Bovey said the drugs offence was of "a comparatively minor nature" and appeared to relate to Wright briefly holding a packet of cocaine which was transferred to someone else.

He argued that given the passage of time without any repetition of either it was impossible to say Wright posed a high risk of further sex and drugs offending.

Lord Johnston said the appeal judges did not have to decide on the appeal issue raised over compassionate circumstances and respect for family life under human rights provisions in the case.

But the senior judge said: "We have considerable concerns as to whether the tribunal properly considered the issue of reasonableness in respect of Miss Swinney's position."

"It is to be hoped that the issue will be taken into account when the matter is reconsidered by the tribunal," he added.