A man known to pose “a substantial likelihood” of causing physical harm and who had two recent indecent exposure cases dismissed is now charged with trying to rape a student in a Minneapolis college bathroom stall.

Asad Abu Mohamed, 32, of Bloomington, was charged Monday in Hennepin County District Court with third-degree criminal sexual conduct, making a terroristic threat and assault in connection with the Friday midday attack downtown at Minneapolis Community and Technical College. The attack was interrupted when passersby heard the 19-year-old woman’s screams and came to her rescue.

In 2016, Mohamed was charged twice in Hennepin County with indecent exposure. In one incident, he masturbated in front of a female employee at a Taco Bell in Bloomington, and in the other he exposed himself while walking outside and inside a Super­America in Richfield.

However, both charges were dismissed, one due to mental illness and the other because of chemical dependency, according to court records.

The court twice put him under civil commitment in 2016, once for chemical dependency and later for mental illness.

A filing in one of those orders revealed that he experiences hallucinations and “catatonic-like behaviors.” It added that he “engages in grossly disturbed behavior [and] poses a substantial likelihood of causing physical harm.”

Another commitment filing said he has threatened to harm family members, has been hospitalized at least twice for mental difficulties and severe abuse of methamphetamine, marijuana and alcohol.

Lisbeth Nudell, Mohamed’s attorney for one of the commitment cases, said Tuesday that “there was nothing in the paperwork I saw that remotely [suggested] he was being looked at as a sex offender for any reason. There was nothing that I remember that was particularly alerting.”

According to the criminal complaint:

Police arrived shortly after 1 p.m. and saw people comforting a woman while campus security officers struggled to control Mohamed.

The woman told police she entered the bathroom and found one stall to be locked despite not seeing any feet below the door, prompting her to use the next stall over.

Mohamed was standing on the toilet in the locked stall before he crawled in where the woman was sitting with her pants down. She screamed and kicked at Mohamed, who put his hand over her mouth and threatened to kill her.

People passing by heard the screams, went in the bathroom and saw Mohamed choking the woman and smoking a glass pipe while the woman was kicking and screaming.

Security officers grabbed Mohamed and pepper-sprayed him when he resisted and swung the jagged-edged glass pipe at them. The officers had him handcuffed by the time city police arrived.

Mohamed told a police officer who was frisking him for weapons that “I’ll rape you too.”

Mohamed remained jailed in lieu of $150,000 bail. A message was left with his attorney Tuesday afternoon seeking a response to the allegations.

Court records stretching back five years reveal many more times he’s been charged with crimes, some as small as minor traffic violations to drug possession to burglary to domestic assault. He’s currently on probation in Ramsey County for a felony drug offense and for two misdemeanor convictions in Hennepin County, one for a transit fare violation and another for trespassing.