Image copyright Edmonton Police Service Image caption The woman was stabbed all over her body by her attacker

Canadian officials have expressed outrage over the case of a homeless woman who was jailed after being raped and kept in prison with her attacker.

The indigenous woman, who is not being named, was brutally attacked in an Edmonton apartment in 2014.

She went to police but was jailed for not answering questions, and forced to testify while wearing leg shackles.

Alberta Justice Minister Kathleen Ganley has apologised to the woman's family and ordered an investigation.

"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 Mrs Ganley, adding that "both policies and people failed in this case".

The woman had been kept in a holding cell next to her attacker for five days and transported to court with him, in the same van, CBC News was the first to report.

"I'm the victim and look at me, I'm in shackles," she told Alberta court Judge Raymond Bodnarek in 2015.

"You're going to go back to remand tonight," he replied, "so that we can get you back here tomorrow."

"Shackles," the 28-year-old woman angrily responded, according to court records. "Aren't you supposed to commit a crime to go to jail?"

She was ordered to a cell under a federal criminal law that allows witnesses to be detained if they refuse to answer questions, after she had had been having trouble focusing, and was falling asleep during the first day of testimony.

Image copyright Edmonton Police Service Image caption Her attacker approached her after finding her sleeping rough in a stairwell

The woman, who was a member of the Cree tribe, died in an unrelated shooting months after the attack.

Her attacker, Lance Blanchard, was convicted of aggravated sexual assault, kidnapping and unlawful confinement.

Justice Minister Ganley has set up a committee to recommend policies to prevent a similar situation.

"There weren't any policies in place to indicate she shouldn't have been shackled," Mrs Ganley said at a press conference after the CBC investigation.

"Now, that being said, I'm a little surprised that no one looked at the case and said that this isn't appropriate," she said, adding that the woman's race may have played a role in her treatment.

In addition to the committee, Mrs Ganley has also ordered an independent investigation.