A 22-year-old man was arrested Friday in Boulder for attempted sexual assault, among other crimes, police say.

Zachary Smith was hiding in a woman's closet inside her home around 5:30 p.m. and jumped out when she got home, the City of Boulder says. He got on top of her, held a knife to her throat and threatened to sexually assault her, police say.

She was able to fight off the suspect and escape - and promptly called police.

A K9 deputy from the Boulder County Sheriff's Office found Smith in an alley between 970 and 980 9th Street.

Smith is being held at the Boulder County Jail on charges of attempted sexual assault, first-degree burglary, trespassing and obstructing justice.