Gabriel Emmanuel removed two bedroom window screens to get into a home around 8 a.m. Tuesday, according to San Bernardino police.
Officers say the victim and her 3-year-old daughter were inside when she tried to stop Emmanuel from entering the home. The suspect claimed he was being followed by another man.
When the victim tried to use her phone to call for help, police say Emmanuel knocked the phone out of her hand. The woman then tried to leave the home but was stopped by Emmanuel.
The victim's daughter saw Emmanuel and began crying, and the suspect allegedly threatened the victim, saying if she didn't want the child hurt, she had to comply.
Emmanuel forced the victim into her bedroom and locked himself inside with the victim, police say. He then removed his clothing and attempted to sexually assault the woman, who was able to fight him off and scream for help.
He took off on foot but was later arrested.
SEE ALSO: Good Samaritan saves woman from attempted sexual assault