A man jailed for attempting to rape a woman has had his conviction overturned because a sheriff misdirected the jury during his trial.

Patrick O'Neill was given a 42-month sentence by sheriff Annella Cowan for assault with attempt to rape, assault and the supply of cannabis in January.

An appeal against his conviction for attempted rape was granted on Friday after Appeal Court judges ruled a miscarriage of justice had occurred.

They said Ms Cowan had failed to direct the jury to an inconsistent statement made by the woman O'Neill was accused of attempting to rape in Aberdeen last August.

They also said she had failed to advise the jury properly on an aspect of corroboration.

In a written judgment published on Friday, judges said: "We are satisfied that this is a case in which a direction was required, that the misdirection in context was a material one and that a miscarriage of justice has occurred. We will accordingly allow the appeal."

O'Neill will still serve two nine-month sentences for assault and the supply of cannabis.