A man accused of murdering his Jewish neighbor in Paris will not stand trial after a French court ruled Thursday he could not be held responsible for the killing because he was in a psychotic state from smoking marijuana.

Kobili Traore is alleged to have beaten his neighbor, 66-year-old Sarah Halimi, to death in 2017 while calling her a demon and shouting about Allah, before throwing her body from the window of her third-story apartment.

The appeals court, whose decision Thursday ended Traore’s detention, ordered he be hospitalized or made to attend a drug rehabilitation program. It also ordered security measures be put in place for 20 years, including a ban on him from contacting the victim’s relatives or returning to the crime scene.

Get The Times of Israel's Daily Edition by email and never miss our top stories Free Sign Up

But Traore “does appear to have voluntarily ended the life of Sarah Halimi,” the court ruled, saying the killing was partly because of anti-Semitism.

The court also retained the aggravated element of a hate crime in the indictment against Traore, but determined it would not go to trial because Traore was not fully aware of his actions on the night of April 3, when he killed Halimi, according to the court.

The French Jewish community has long claimed Halimi, a physician and kindergarten teacher, was the victim of an anti-Semitic crime.

The appeals court’s decision “marks the advent of a policy that gives impunity to anti-Semitic murder in France, EUJF, the French-Jewish student association, wrote Thursday on Twitter.

Last January, Traore was determined fit to stand trial following an assessment. But that was overturned after a judge requested a second series of tests, which determined that the Malian immigrant was not able to stand trial.

A third assessment found Traore did not suffer from mental illness, but that he could not be held responsible for his actions at the time of Halimi’s murder as he was in a state of “acute delirium.”

Prosecutors initially announced after Halimi’s killing that it was an anti-Semitic crime.

Traore pummeled Halimi, a physician and kindergarten teacher, for an hour as police stood outside the woman’s door, according to reports. He shouted about Allah and called her a “demon” before throwing her to her death. Traore had called Halimi’s daughter “dirty Jewess” two years before killing the mother, the daughter has said.