HIGHLAND PARK, N.J. (AP) — A New Jersey man who sexually assaulted and beat a woman after forcing her into an apartment building at gunpoint while she was walking with a child has been sentenced to 23 years in prison.

Brandon Cox will also have to register as a sex offender under the sentence imposed Monday.

The 23-year-old Franklin Township man had pleaded guilty in June to kidnapping and aggravated sexual assault. The counts stem from a Feb. 19 attack in Highland Park.

Middlesex County prosecutors say Cox approached the woman and soon forced her into the basement of the apartment building at gunpoint. He then sexually assaulted her and punched her repeatedly before fleeing.

Authorities say the woman ran to a nearby home following the attack, and a resident there called police.