The Supreme Court of Canada on Friday ruled that defendants accused of violent crimes such as homicide and sexual assault can use self-induced extreme intoxication as a defense, striking down a federal law supported by women's advocacy groups.

The court said a 1995 law that prohibits the defense was unconstitutional and violated Canada's Charter of Rights and Freedoms.

"Its impact on the principles of fundamental justice is disproportionate to its overarching public benefits. It should therefore be declared unconstitutional," writing for a unanimous Supreme Court, Justice Nicholas Kasirer said of the law.

At issue was whether defendants accused of a violent crime in a criminal court can raise extreme intoxication - known as "non-mental disorder automatism" - as a defense.

In doing so, defendants can claim their actions were involuntary as a result of taking drugs or alcohol, and they therefore cannot be held criminally responsible.

Federal Justice Minister David Lametti said Ottawa was carefully reviewing the decision.

"It is critically important to emphasize that today's decision does not apply to the vast majority of cases involving a person who commits a criminal offence while intoxicated," he said in a statement.

The Supreme Court said it is the law in Canada that intoxication short of automatism is not a defense for the kind of violent crime at issue.

Canadian courts have been divided on the matter, while women's advocacy groups say the law is needed to protect women and children as violence disproportionately affects them.

Four out of every five victims of intimate partner violence were women, who are five times more likely to experience sexual assault, based on Canadian government data.

"We know that the criminal justice system too often fails and retraumatizes survivors of sexual violence," said Kat Owens, project director at the Women's Legal Education and Action Fund (LEAF). "We need to improve existing responses to sexual violence, while exploring alternative responses and working to prevent gender-based violence."

The issue came before the Supreme Court last fall when justices heard arguments regarding the constitutionality of the statute as it pertained to three separate cases. In Friday's ruling, the court said a trial can be ordered in one of the cases while restoring an acquittal in another.

The third case involved David Sullivan, who attempted suicide in 2013, by taking a prescription drug known to cause psychosis. In a psychotic state, he stabbed his mother, whom he thought was an alien. Sullivan was convicted of aggravated assault and assault with a weapon after the judge said he could not use an extreme intoxication defense.

The Court of Appeals found the extreme intoxication law unconstitutional and acquitted him. Prosecutors appealed the ruling to the Supreme Court, which upheld his acquittal.

Kasirer wrote that Parliament has other paths to achieve its goals to address extreme intoxicated violence.

(Reporting and writing by Brendan O'Brien in Chicago, additional reporting by David LjunggrenEditing by Jane Merriman, Barbara Lewis and Richard Chang)