A Canadian judge who asked a woman in court why she couldn’t keep her knees closed during an alleged rape has resigned.

On March 9, Alberta Federal Court Justice Robin Camp stepped down after the Canadian Judicial Council recommended he be removed from the bench, per the BBC.

In 2014 a then 19-year-old woman accused Alexander Wagar of raping her over a bathroom sink during a house party, the Washington Post reported in 2016.

During the trail, Camp referred to the woman as “the accused” and suggested she could have prevented the attack, according to a notice of allegations posted on the Canadian Judicial Council website.

Justice Robin Camp - known for his 'keep your knees together' comment - resigns https://t.co/9VeifSKUfc pic.twitter.com/kW7u7D3BuW — CBC Toronto (@CBCToronto) March 10, 2017

The notice describes Camp asking the woman:

“Why couldn’t you just keep your knees together?” and “Why didn’t you just sink your bottom down into the basin so he couldn’t penetrate you?”

Camp also said that young women “want to have sex, particularly if they’re drunk,” and told the accuser that “some sex and pain sometimes go together” and “that’s not necessarily a bad thing.”

Camp acquitted Wagar of sexual assault. The Alberta Court of Appeal overturned the acquittal, but in January 2017, Wagar was acquitted again.

The following scathing review, published by the Canadian Judicial Council on March 8, concluded that Camp’s behavior during the trial undermined public confidence and rendered the judge “incapable of executing the judicial office.”

He made me hate myself and he made me feel like I should have done something ... that I was some kind of slut." Wagar's alleged victim

The alleged victim said that Camp’s comments led her to consider suicide.

“He made me hate myself and he made me feel like I should have done something ... that I was some kind of slut,” she said, according to HuffPost Canada.

In a statement announcing his resignation, Camp apologized “to everyone who was hurt by my comments during the Wagar trial.”