A former Oklahoma City police sergeant accused of molesting his three adopted sons pleaded guilty Tuesday to multiple sexual abuse charges and was sentenced to two years in the county jail.

Maurice A. Martinez, 46, of Oklahoma City, avoided a trial and potentially a lengthy prison term by reaching a deal with prosecutors that includes two years of house arrest when he is released from jail and 25 years’ probation, court records show.

With credit for time served, Martinez likely will be out in a year. Prosecutors said the plea bargain came after it became clear witnesses were reluctant to testify against him.

Martinez pleaded guilty to 12 felonies, including nine counts of sexual abuse of a child, and one count each of attempting to prevent a witness from testifying and possession of child pornography and child abuse, records show.