A man accused of stalking Taylor Swift outside her Manhattan apartment has been declared mentally unfit for trial, prosecutors say, meaning his criminal charges will be dismissed and he will be transferred to a mental health facility.

The Manhattan District Attorney’s office said Friday it had confirmed the results of a psychiatric examination that found David Crowe “unfit to stand trial” on misdemeanor charges of stalking, harassment and contempt. Crowe was arrested three times last month outside Swift’s TriBeCa building.

Related

“The criminal case is now dismissed by function of law,” a spokeswoman for the Manhattan District Attorney’s office said in the statement. “He will now be committed to the custody of the Office of Mental Health to receive necessary treatment.”

In a statement, Crowe’s public defender, Katherine LeGeros Bajuk, said: “We are pleased that all parties now agree to the obvious truth that Mr. Crowe is too ill to proceed, and that he requires treatment, not jail. We look forward to ensuring Mr. Crowe is provided with the psychiatric treatment and supportive social services he needs to achieve a successful and stable re-entry into society.”

Though he will not face charges, Crowe will not simply be released. He will committed to a mental health treatment facility, where he will be confined for an undefined time period until deemed fit to be released by doctors. Prosecutors can argue against any potential future release, and often seek civil court protection orders barring defendants like Crowe from contacting victims like Swift after they’re released.

In charging documents, prosecutors alleged that Crowe had been spotted roughly 30 times near Swift’s apartment building since late November, and that on multiple occasions he had stated that he was there to speak to the superstar.

The Seattle native was first arrested on January 20, after police responded to a 911 call regarding a “disorderly person” near Swift’s apartment. Crowe had allegedly “attempted to open a door to a building at the location” and was taken into custody on a previous arrest warrant. After he was released, Crowe was arrested again just two days later in the same area, after witnesses reported an “emotionally disturbed male acting erratically” and police spotted him “harassing multiple complainants.”

Crowe was released from custody again on Jan. 24 after he was arraigned on stalking and harassment charges. Though the judge imposed a strict protection order, Crowe then apparently bee-lined back to the vicinity of Swift’s apartment, where he was arrested for a third time and charged with criminal contempt.

After Crowe’s third arrest, prosecutors warned the judge that he had willfully disobeyed her previous ruling and made clear that he would not abide by future restrictions. Following that hearing, the judge ordered Crowe to remain in custody while he awaited further proceedings.

If he had gone to trial on the original stalking charges — all misdemeanors — Crowe could have faced up to 18 months in prison if convicted. If also convicted on the later charges — two counts of second-degree criminal contempt for breaching his protection order, also misdemeanors — he could have faced an additional two years in prison.