A man who held armed police at bay while repeatedly raping a student has succeeded in his attempt to have his minimum sentence cut.

Sean McKay, 43, was jailed for life in 2008 after being convicted of carrying out the 13-hour ordeal.

Judge Lord Kinclaven gave him a Lifelong Restriction Order which means he can only be released if a parole board decides he is no longer a threat to the public.

At the time of sentencing, Lord Kinclaven set a minimum sentence of nine years before he could be considered for release.

During his trial, the court heard McKay held his 27-year-old victim prisoner at his flat in Edinburgh's Abbeyhill on January 23, 2008.

Armed police were called to his property and cordoned off the area overnight.

The court had heard McKay met the woman, who cannot be named, in a cafe near his flat. He said he wanted to buy art from her and took her back to his home.

Once she was in the flat, he produced a large kitchen knife. Over the course of the next 13 hours the woman was raped repeatedly and indecently assaulted before police arrested him.

McKay appealed against the nine-year minimum sentence.

His legal team argued that thanks to a recent appeal court judgment, the way in which judges once used to calculate how long offenders should serve in jail was incorrect.

In March 2011, lawyers arguing for paedophile Morris Petch, 54, and rapist Robert Foye successfully argued that High Court judges were acting wrongly when working out how long people had to serve.

McKay's lawyers used the same arguments to appeal his sentence.

On Thursday, at the Appeal Court in Edinburgh, Lord Mackay of Drumadoon and Lord Brailsford cut his sentence to six years.

However, in a judgement issued by Lord Mackay, the judge warned that his decision would not mean that McKay would be automatically released after serving six years.

The judge wrote: "In allowing the appeal and fixing the punishment part for six years, we stress that it is the minimum period that the appellant will require to serve in custody before the parole board can consider whether and, if so, when the appellant should be released back into the community."