A 22-year-old man has pled guilty to raping and threatening to kill a woman in her home in Livingston.
John McKeown attacked the 39-year-old after he entered the house through an unlocked door last November.
Once inside, he used knives to force a man and a child to stay upstairs while he assaulted the woman.
At the High Court in Edinburgh, the judge, Lord Stewart said he was considering imposing an extended jail term at next month's sentencing.
The court heard kitchen porter McKeown, who had been at a nightclub hours before the attack, had drunk lager and whisky and taken cocaine during the course of the evening.
In the early hours of the morning, the victim heard creaking on the stairs outside her bedroom and opened the door to McKeown, who was armed with an eight-inch knife.
McKeown, who is said to have mild learning difficulties, told the woman and a man who was in the house that he would kill them both.
The attacker then ordered the woman to hand over all mobile phones, and also asked a child to search under the bed for any other phones.
He then went through the house, ripping out telephone and internet connections and closing blinds, before ordering the man and child into one of the bedrooms.
After he raped the woman, McKeown started crying and said: "Sorry, I've just done the worst thing."
He then handed her the knives and said: "Phone the police, I'm done."
Prosecutor Gillian Wade said the woman was "extremely upset and emotional" after the attack.
The court heard she had suffered post-traumatic stress after the incident.
Ms Wade told the court: "He (McKeown) had been in the house holding the victims in abject terror for an hour-and-a-half.
"The victim describes how this incident has affected her everyday life, prevented her going out for some time and required a prescription to help her nerves at first.
"She was nervous at home for quite some time afterwards and could not leave the house alone. She lost her voice, which her doctor put down to post-traumatic stress."
The child was said to have become "hesitant" following the incident.
Ms Wade added: "The complainer states the accused was calm throughout but menacing to the extent that she was sure she and the other witnesses were going to be killed."
McKeown, who has no previous convictions, was remanded in custody until his next court appearance.