A mentally ill man accused of forcing a 12-year-old girl behind a building in North Ogden and raping her in 2015 has been sentenced to prison for up to life.

Martize DeAngelo Washington, 22, was charged in 2nd District Court with first-degree felony rape of a child.

In May, he pleaded guilty and mentally ill to attempted aggravated sexual abuse of a child.

Washington has a history of mental health issues dating back to his juvenile years, according to court records, which add that when he does not take his medications, he hears voices, has delusions and exhibits aberrant behavior.

Competency evaluations and treatment delayed the rape case for about two years, court records show.

On Tuesday, a judge sentenced Washington to three years to life at the Utah State Prison.

The sexual assault occurred on July 29, 2015, when the girl and Washington — who were online acquaintances — met in person at a North Ogden grocery store.

The girl told police that she walked with Washington to a health care clinic at 2400 N. 400 East, where he forced her into the building’s dumpster enclosure and raped her while she screamed for help, according to charging documents.

Nurse examiners later confirmed evidence of rape.

The girl told police the man’s name was Martize, and officers found messages between the girl and Martize Washington on Facebook, charges state.

Washington was located at a Motel 6 in Ogden, where police found clothes like the ones the girl described, and a glass pipe officers say is used to smoke meth.

Washington bailed out of the Weber County jail days after his arrest in the rape case. But he was arrested again on Dec. 7, 2015, after police say he was knocking on doors in an Ogden neighborhood with a machete in hand.

He also had two 12-inch kitchen knives and a glass pipe and marijuana, charges state.

He was charged with weapons and drug counts, which were dismissed as part of his plea deal in the rape case.