QUEENS (PIX11) — A homeless man allegedly tried to rape a woman in a Queens building earlier this month before her screams prompted a good Samaritan to intervene, police said Thursday.

Damel Dennis, 43, allegedly grabbed the woman by the face and tried to pull her pants down inside a bathroom in a building lobby near Crescent Street and 41st Avenue on Feb. 8 at 10:40 p.m., according to the NYPD. A good Samaritan confronted the attacker after hearing the 34-year-old woman scream for help, forcing him to flee, police said.

Authorities said Dennis was allegedly exposing himself outside the bathroom and pushed his way in when the victim was leaving the restroom. The woman was not injured.

Dennis ran into the Queensboro Plaza subway station after the incident, police said.

Dennis was arrested Wednesday and charged with burglary, attempted sex abuse, and public lewdness, police said. His arraignment was pending, as of Thursday morning.