A Harpswell man accused of sexually assaulting a girl for two years starting when she was 11 years old pleaded guilty Tuesday to two felony counts and was sentenced to serve at least 5 1/2 years in prison and 17 years of probation.

Amos Johnson, 39, began molesting the child in 2011 and continued to assault her more than 40 times until February 2013, according to the prosecutor, Assistant District Attorney Hannah May.

The victim told Johnson’s girlfriend, Holly Colfer, after the first incident that Johnson had sexually assaulted her, but Colfer “did nothing,” May said.

Johnson continued to molest her until the girl “broke down” and reported to the state Department of Health and Human Services what had been happening, May said.

Johnson pleaded guilty before Justice Roland Cole in the Cumberland County Courthouse in Portland to two counts of gross sexual assault as part of a plea agreement in which 30 more identical counts were dismissed. Gross sexual assault is a Class A felony punishable by up to 30 years in prison.

The judge sentenced Johnson to 20 years on the first count with 5 1/2 years to be served behind bars, while the remainder is suspended for a 15-year probation term.

Under the terms of the plea agreement, Johnson will not begin serving the sentence on the second count until he completes his prison and probation terms on the first count.

Cole sentenced Johnson on the second count to 10 years, all of it suspended for a two-year probation term.

If Johnson completes both sentences without violations, he faces a minimum of 5 1/2 years in prison and 17 years of probation. If he is unsuccessful on probation, he could serve the full 30 combined years in prison.

“These are extraordinarily serious charges,” Cole said. “They have caused incredible emotional turmoil for (the victim) and her family.”

The judge acknowledged that he considers the sentence he imposed a “light sentence,” but said he accepted the plea deal in part because it spared the victim from having to testify at trial.

“A lot of consideration has to be give to the victim and not further victimizing her through the criminal justice system, and I accept that,” Cole said.

Johnson stood beside his attorney, Jon Gale, at the hearing, in a beard and mustache, his glasses hanging from the neck of his orange jail uniform.

“I want to apologize for my actions, to take full responsibility for them,” Johnson said.

As conditions of his probation, Johnson is ordered to have no contact with the victim or Colfer.

Gale requested that Johnson be allowed to write letters and stay in contact with Colfer, since she was not a victim in the case. The judge said that will be up to the Department of Health and Human Services to decide while Johnson is in prison and to his probation officer afterward.

An affidavit filed in court by Detective Trevor Cote of the Cumberland County Sheriff’s Office in support of Johnson’s arrest said the girl reported the abuse on Feb. 26, 2013. She said Johnson had told her that he wanted to have sex with her and she was worried about what he might do if he said no. The girl said the encounters began when she was 11 and continued past her 13th birthday.

Police interviewed Johnson, who initially denied the allegations but then admitted to the sexual encounters, according to the affidavit.

The girl also told police that Johnson asked to have sex with both her and Colfer, which did not happen.

Colfer told police that she knew about some of the abuse and confirmed that Johnson asked about having sex with her and the girl, according to the affidavit.

Johnson has remained in custody since his arrest on Feb. 26, 2013, and will receive jail credit for time he has already served.

Colfer pleaded guilty last June to a single misdemeanor count of endangering the welfare of a child and was sentenced to serve 31 days of a 364-day jail term, according to court records.