Canadian authorities have launched an investigation after it emerged that a sex assault complainant in Alberta was shackled and detained in the same jail as her attacker – and even transported to court with him in the same prison van – in order to ensure she would testify.

“The facts of this case are disturbing and tragic, and when you add in the treatment of the victim in the system, they are almost incomprehensible,” said Kathleen Ganley, Alberta’s justice minister. “What is clear is that both policies and people failed in this case.”

The case stems back to a 2014 attack in the city of Edmonton. The First Nations woman, whose identity is protected by a publication ban, was homeless at the time and was sleeping in the stairwell of an apartment when she was woken by a man holding a knife at her throat.

The man – a convicted sexual offender – dragged her by the hair up the stairs to his apartment, she told the court. As she attempted to fight off the sexual assault, she said she was stabbed repeatedly. She managed to call for help, and first responders found her covered in knife wounds and bruises where the man had tried to choke her.

Lance Blanchard, a convicted sexual offender. Photograph: Edmonton Police Service

One year later she faced her attacker again – this time in court for the preliminary hearing. Court documents noted that she was having trouble staying awake and answering questions, leading the crown prosecutor to request that she spend the weekend in custody. The provincial judge agreed, making use of a provision of the federal criminal code that allows witnesses to be detained if they refuse to answer questions.

Days later, the woman was back in court to testify. She begged the judge to release her from custody, asking to instead stay with her mother and promising she would return to court to answer questions.

“It’s not a pleasant scene I’m living,” she told the judge. “I’m the victim and look at me, I’m in shackles. Aren’t you supposed to commit a crime to go to jail?”

The judge refused, believing the woman to be a flight risk. Instead – as the Canadian Broadcasting Corporation reported this week – the woman was detained at the same facility as her attacker for five nights and, on at least two occasions, was driven to court in the same prison van as her attacker.

The man, Lance Blanchard, was eventually convicted of charges that included aggravated sexual assault, kidnapping and unlawful confinement. Months after she was forced to testify in shackles and handcuffs, the woman was killed in an unrelated shooting.

On Monday, Alberta’s justice minister said the province had launched an independent investigation into the woman’s experience and had also struck a committee, made up of representatives from the justice system, to explore the gaps in policy that might have given rise to the woman’s treatment. “She was the victim of a horrific crime,” said Ganley. “And when she came to the justice system, we failed to treat her with the respect and dignity she deserved.”

The minister – who has also apologised to the victim’s family – said she had never heard of any other complainant being treated in this way and raised the possibility that institutional racism may have played a role. “One of the questions that keeps me up at night is whether it would have been the case that if this woman was Caucasian and housed and not addicted, whether this would have happened to her,” said Ganley.

The investigation in Alberta comes amid a Canada-wide conversation on how the justice system deals with sexual assault complaints. Earlier this year, Robin Camp, the Calgary judge who made headlines around the world after asking a complainant in a rape trial why she couldn’t just keep her knees together, resigned, hours after the federal disciplinary body recommended that he be removed from the bench. His resignation came as calls were mounting for the removal of a Nova Scotia judge who told a courtroom “clearly, a drunk can consent”, before acquitting a taxi driver accused of sexually assaulting a female passenger who was found half-naked and unconscious in his cab.