A Brooklyn man was arrested for the attempting to sexually assault a woman in her apartment.

Hua Qin Ye, 29, rang the bell of an apartment in Brooklyn and when the occupant answered, he forced his way into the residence and tried to sexually assault a 51-year-old woman, according to the TWC News.

While Ye forced the woman into her bedroom, her 50-year-old roommate called the police. Together, the women were able to beat off their assailant and hold him until authorities arrived.

According to The New York Daily News, when police arrived at the apartment, Ye was still inside. Initially Ye resisted arrest, but officers were able to quickly lead him away.

The alleged assailant was taken to Bellevue for a psychiatric evaluation following his arrest. The women were taken to another hospital for minor cuts and bruises sustained during their scuffle with Ye.

Ye has been charged with attempted rape, robbery, and resisting arrest.