The NYPD has arrested a man they said tried to sexually assault an 8-year-old girl as she entered her apartment building in the Bronx last month. 

Police said the suspect, Justin Ramirez, 21, approached the child from behind when she was entering her building in the Fordham Heights neighborhood of the Bronx around 5:30 p.m. on Oct. 24.

Ramirez, who police said is homeless, restrained and sexually abused her before fleeing. 

RELATED: Sketch released in sexual assault of Bronx girl

She was treated at a local hospital and released. 

Ramirez was arrested on charges of sex abuse, forcible touching and endangering the welfare of a child.

RELATED: Police seek information on Brooklyn man found shot in car