The man prosecutors say brutally attacked, then sexually assaulted a woman in Queens appeared Thursday in court.

A judge ordered 21-year-old Ronald Williams to undergo psychiatric treatment during his arraignment.

Officers arrested him Tuesday at a South Carolina motel for violating his probation.

He was extradited back to the city, and now faces assault, sexual abuse, and unlawful imprisonment charges.

Williams is accused of following a 52-year-old woman after she dropped her son off at school back on April 30.

Prosecutors say he dragged her to an apartment building's outdoor stairwell on 72nd Road in Kew Gardens Hills then beat and sexually assaulted her.

According to a criminal complaint, Williams admitted to pushing the woman down the stairs and punching her in the face, but claims he only wanted to rob her.

The victim was found bleeding from her head, face, and body, and her pants had been removed.

She remains at the hospital, where she is being treated for a fractured neck and eye socket.

Meantime, Williams is due back in court next month, and if convicted, he faces up to 25 years behind bars.