A sex attacker was jailed for five years today after raping a vulnerable woman who was suffering from severe dementia.

John Allan, 43, invited the victim to his home after an early morning meeting and subjected her to the assault after deciding his "luck was in".

A judge told Allan: "You have been convicted of the rape of a very vulnerable woman who was incapable of consent. She was a stranger to you."

Lady Scott told the rapist at the High Court in Edinburgh: "You were only interested in your sexual gratification."

The judge said that the "opportunistic nature" of the offence involving such a vulnerable victim required a substantial custodial sentence.

She said: "You invited her into your house. When she followed you in you decided, in your words, 'your luck was in'."

Lady Scott, who had deferred sentence on Allan for a background report, said it was clear he had "a derogatory attitude" towards women but added he had no history of sexual offending.

The judge said it appeared that he now accepted that he must address his drinking.

Lady Scott told Allan that he would be placed on the sex offenders' register indefinitely following his earlier conviction for the rape of the 61-year-old woman.

Allan had claimed that he had consensual sex with the woman on June 19 in 2017 at his home in Murray Street, in Ayr.

But a jury at his trial convicted him of raping the woman who was incapable of consenting to sex because of a mental disorder. During the assault he took off her clothes.

The woman did not give evidence in court due to her condition but jurors heard statements she gave to specially trained officers and a videoed interview.

She said she went for a walk about 5.15 am and bumped into a man, who was on his own and carrying something. She helped him with a beer keg.

She said: "I didn't know this man but he said he knew me and I said 'I have dementia' and told him I was 61.  He said 'You look 51'."

The woman said that at his home he started talking about sex. She said: "I didn't know what he was talking about. I told him I wanted to go home."

She said Allan undressed her and then himself and put her on a bed. She added: "I didn't understand what was happening."

After the assault she dressed and left but did not know where she was. She said: "I was upset and crying."

When she arrived home she told relatives what had happened and the police were contacted. Allan clamed he had consensual sex with the woman and said: "It was just spontaneous sex."

Prosecutor Ashley Edwards QC asked him: "Did she tell you she was 61?". Allan replied: "I wasn't paying much attention to what she said."

Defence counsel Lorenzo Alonzi told the judge: "My Lady will recall the quite unusual circumstances of this case and will recall that alcohol played a part in it."

He said Allan's position was that he believed the woman was consenting but due to him being intoxicated his belief was not a reasonably held one in the circumstances.

The defence counsel said: "He accepts that had he not been intoxicated this would not have happened."

He said that Allan, who has three children from a previous marriage, was on his way home when "two different worlds collided".

Mr Alonzi said: "He is committed to remaining off alcohol when he is eventually released from custody."