PORTLAND — An 18-year-old from Portland pleaded guilty Thursday to breaking into a woman’s apartment as she slept and raping her.

Mohammed Mukhtar had sought to be tried on the charges as a juvenile. Under his plea agreement, Mukhtar, who came to this country as a boy from war-torn Somalia, will face eight years in prison and could be deported after he is released.

His sentencing is scheduled for next Thursday in Cumberland County Unified Criminal Court.

Communicating through a translator and speaking in a mix of Somali and English, Mukhtar pleaded guilty Thursday to three felonies — gross sexual assault, burglary and aggravated criminal trespassing — and one misdemeanor charge of criminal trespassing.

He struggled at times to understand and answer questions from Judge Richard Mulhern, often answering in grunts or in a voice too quiet to be heard.

“What if I did not commit? What if I just do the time,” Mukhtar asked at one point.

Mukhtar’s attorney, Jonathan Berry, sat down with him twice during the hour-long hearing to explain the legal procedures. The judge explained to him several times that he was waiving his right to a trial by pleading guilty.

Mukhtar, with freshly cut hair and an orange jail uniform, turned around repeatedly to glance back at his family members in the courtroom.

The prosecutor, Assistant District Attorney Deborah Chmielewski, said that if the case had gone to trial, she was prepared to show videos and call witnesses who would say that Mukhtar entered an apartment complex on High Street around 3 a.m. on May 26, 2012, by climbing through a window of a man’s apartment, then entered the woman’s apartment elsewhere in the building.

Chmielewski said the 50-year-old woman awoke to find Mukhtar in her bed, raping her. The prosecutor said he left behind a condom with his DNA on it and a condom wrapper with his fingerprints on it.

The woman, who testified against Mukhtar in juvenile court in November, wants to write a letter to the court before Mukhtar’s sentencing, Chmielewski said.

Mukhtar’s attorney, Berry, said the agreement for eight years of straight prison time, rather than prison time followed by probation, served both sides because Mukhtar will likely not be free again in this country.

“The straight time is going to further a quicker self-deportation after serving the sentence,” Berry said. “There’s no guarantee, due to the diplomatic relations with Somalia, or lack thereof. He certainly wants to return to Africa, rather than engage in administrative handling of probation after he serves the sentence.”

From the time of Mukhtar’s arrest, two days after the rape, the case against him went back and forth between juvenile court and adult court.

Mukhtar was first charged as an adult, as Portland police used the birth date he had given them: Jan. 1, 1994.

Berry subsequently argued successfully that Mukhtar was assigned the Jan. 1 birth date when he came to the United States as a refugee, and that his actual birthday is Oct. 25, 1994, so he was a juvenile at the time of his arrest.

The adult charges against Mukhtar were dropped last summer and raised in juvenile court.

Prosecutors sought to reverse that, calling witnesses at juvenile court hearings in November and January to show that Mukhtar’s case should be in adult court for several reasons, including the severity of the charges.

Mukhtar dropped his objections in January, as the final witnesses were about to be called.

After Mukhtar’s plea Thursday, the judge ordered him held without bail pending sentencing.

Scott Dolan can be contacted at 791-6304 or at:

sdolan@pressherald.com