An American woman who spent five years with her family as hostages in Afghanistan has described in court how she escaped from her former husband’s alleged abuse after they returned to Canada.

Caitlan Coleman told a packed Ottawa courtroom that on the night of her escape she put on several pairs of socks to prepare for a “dangerously cold” Ottawa winter night, because she could not reach her shoes from the bedroom where Joshua Boyle had confined her in a fit of rage.

“I made the decision that I was going to run for it – run for help,” Caitlan said on Monday, as she described the moment she fled. “It took me a while to get up my courage to do it. But I did,” she said.

Coleman, 33, and Boyle, 35, were kidnapped in 2012 by Taliban-linked militants while they were backpacking through Afghanistan. They spent five years as hostages and had three children in captivity, before they were eventually rescued by Pakistani forces in 2017.

Boyle, 35, was arrested two months after their rescue, and charged with 19 offences including sexual assault, unlawful confinement and uttering death threats. All of the alleged offences took place after the couple returned to Canada.

Boyle denies all charges.

On the third day of Boyle’s trial, Coleman described of a pattern of physical and emotional abuse, which she said continued as the couple moved between Boyle’s family home, a hotel and an apartment building in Ottawa.

Dressed in a dark dress and wearing a black headscarf, Coleman testified via video link from a separate room in the courthouse. She told the court that as well as subjecting her to physical and emotional abuse, Boyle deliberately confined her against her will.

Coleman testified that on 30 December 2017, Boyle said she could only leave the apartment’s bedroom with his permission. The demand brought back memories of the most “horrifying parts” of their captivity in Afghanistan, when she says Boyle banished her to a shower stall, she alleged.

Left alone in the bedroom which had a back door leading outside, Coleman decided to flee, she said. “This was my best chance – after tonight, it [was] only going to get harder,” she told the court.

Coleman said she planned to run to a neighbour’s apartment upstairs and use their phone to call her mother, who was staying at a nearby hotel.

Unable to reach her shoes – which were kept near the front door – Coleman put on several pairs of socks, then ran out of the back door and upstairs, where she started banging on the neighbours’ door, she said.

Boyle followed closely behind, Coleman told the court. “In a very low voice that was threatening – just above a whisper – he said: ‘When they answer the door, you tell them you were drunk – and you come back in here.’”

Boyle returned downstairs, but nobody answered the door, Coleman said.

“I was hitting the door as loudly as I could … I was at their door yelling: ‘Help! Help!’” she told the court.

Coleman ran outside to a nearby pizza restaurant, where she called her mother, she said. Later that evening, Boyle was arrested by Ottawa police.

Throughout the testimony, Boyle, wearing a navy blazer with maroon slacks, took frequent notes on a white notepad. His sister was seated beside him.

Coleman had previous testified that she had been subjected to violence, manipulation and sexual assault at the hands on Boyle.

On Friday she told that court that on one occasion, he sent her a text message requesting she search online forums to find him a new sexual partner. On another, Coleman alleges she was sexually assaulted while tied up with ropes. She also revealed a list of rules Boyle had allegedly created for her, dictating her behaviour, diet, exercise and frequency of sex.

On Monday, defence lawyer Lawrence Greenspon asked Coleman repeatedly if she was a “violent” person, citing an online comment Coleman had made in 2002.

“I’m not a grump. I’m either easygoing or a terrifying spectre of volcanic rage,” he read, quoting Coleman’s posting on a Star Wars chat forum, where she first met Boyle at age 16.

“I couldn’t tell you with any certainty what was written 20 years ago,” responded Coleman, who later referring to a number of her internet posts as “teenage melodrama”.

As Greenspon pressed her on her previous online behaviour, Coleman requested a break. “Because of the trauma I’ve gone through, I’m feeling a bit triggered … I’m feeling a little bit attacked by your approach,” she told Greenspon.

The defence also questioned Coleman’s ability to “see reality” while she was in a “fit of rage”.

“I had trouble seeing reality with Joshua,” she responded. “That’s why I stayed with him as long as I did.”

Of the 19 charges Boyle faces, 17 involve Coleman. The identity of a second victim is protected by a publication ban. The trial is expected to continue for another seven weeks.