A homeless man was arrested less than 24 hours after he allegedly attempted to rape a 62-year-old woman in her apartment building lobby.

The man, identified as Rubicel Sanchez, was arrested late Friday after two police officers nabbed him for urinating in public near 62 East Broadway in Chinatown, still in the area where investigator said he assaulted a woman earlier in the day.

RELATED: VIDEO: Man tries to rape woman in her East Village building, police say

Officers Daniel Roth and Frank Faber were in uniform and on patrol when they noticed Sanchez, 31, on the street at around 9:15 p.m.

Earlier that day, authorities released video surveillance of a man they believed to be Sanchez in the rear lobby of a building in Chinatown at around 1 a.m.

RELATED: Suspect follows Bushwick woman into apartment, tries to rape her: NYPD

Investigators said Sanchez approached the woman from behind and assaulted her, prompting a struggle. The woman fought her attacker off before he ran away from the building.

The woman refused medical attention.

Sanchez — who police said was homeless — now faces attempted rape and sex abuse charges, as well as burglary.