A judge who asked an alleged sexual assault victim “why couldn’t you just keep your knees together?” is being investigated over the comments.

Canadian federal judge Robin Camp acquitted Alexander Scott of sexual assault in September 2014 while still a Calgary provincial court judge – a decision later overturned by Alberta Court of Appeal.

At various points during the initial trial, Judge Camp asked the complainant, a 19-year-old homeless woman: “Why didn’t you just sink your bottom down into the basin so he couldn’t penetrate you?” and “Why couldn’t you just keep your knees together?”

The Calgary Herald reported that because the complainant said she had asked her alleged attacker if he had a condom, Judge Camp told the court that it was “an inescapable conclusion (that) if you have one I’m happy to have sex with you”.

He also said the complainant had not explained “why she allowed the sex to happen if she didn’t want it?”

Mr Camp was appointed in June to the Federal court of Ottawa but his conduct is now being reviewed by the Canadian Judicial Council.

Professor of law at the University of Calgary, Alice Woolley, said: “The comments were made to her directly in court, not just in the decision.

“Imagine what she felt like in court. She’s a 19-year-old homeless woman. It’s not a good way to treat somebody.’

Judge Camp has since apologised and volunteered to have gender sensitivity counselling.

During the review of his comments, the Federal Court is not assigning him any cases involving sexual conduct or similar issues.

He said in an apology to the Federal Court: “I have come to recognise that things that I said and attitudes I displayed during the trial of this matter, and in my decision, caused deep and significant pain to many people.

“My sincere apology goes out, in the first place, to the young woman who was the complainant in the matter.