A former student who is suing her alleged rapist for damages has told a court she feared she was going to die during the alleged assault.

The woman, known as Miss M, told Edinburgh sheriff court she was “so afraid” during the alleged rape in September 2013, “I didn’t know what was going to happen next ... [I] thought I was going to die”.

Miss M, 23, who at the time was a student at the University of St Andrews in Fife, is suing Stephen Coxen of Bury, Lancashire, for nearly £100,000 in damages for allegedly raping her in her flat during freshers’ week.

She told the court she had since been prescribed a cocktail of drugs to cope with her flashbacks, panic attacks and night terrors, which often left her waking in the night, or caused her to sleepwalk.

She told her counsel, Simon Di Rollo QC, that in the months after the alleged incident she began drinking heavily and regularly, using alcohol to suppress her anxiety attacks and flashbacks. “I don’t sleep very well, I often wake up,” she said. “Maybe once a week I wake up in a panic.”

She became more and more reclusive, she added, and only sought help after university staff and her doctor warned her drinking was dangerous. “It got quite bad,” she said. “It just spiralled out of control.”

Coxen was prosecuted for the alleged attack in November 2015 but cleared by a jury at Livingston crown court who found the charges against him were not proven, a Scottish verdict which acquits an accused but is seen as stopping short of finding them not guilty.

He pleaded not guilty in 2015 and is defending himself against Miss M’s civil action, which is thought to be the first in Scotland in many decades involving a defendant cleared in a criminal trial.

Giving her second day of evidence to a closed court to protect her identity, Miss M was questioned closely by Coxen’s counsel, Stephen O’Rourke QC, over whether she had accurately remembered how much she drank on the night of the incident.

She told the court on Tuesday she had drunk a bottle of wine, a bottle of champagne, four cans of cider, several shots of vodka and another shot of spirits, which may have been tequila, before going to a nightclub where she allegedly met Coxen.

O’Rourke said her account did not tally with several witnesses who did not see her consume that amount of alcohol. He said it would have been very difficult to consume so much in the short time available.

Miss M disputed that. Then 18 years old, she said many students drank heavily and quickly at that age. “I [would] always have the same alcohol, the wine or the cider, whether I drank it in four hours or 40 minutes,” she said.

The court heard that witness statements given to police by her friends before the 2015 trial showed she had been very drunk before arriving at the nightclub, and was stumbling in the street. The bouncer at the student union told one friend she should not be allowed any more drinks.

The hearing is due to continue for six more days.