BANGOR — A Maine man accused of having inappropriate sexual contact with a 12-year-old female relative has pleaded guilty.

Timothy Damien of Bradley pleaded guilty on Tuesday to two counts of unlawful sexual contact just before his trial was about to start.

In exchange for his plea, prosecutors agreed to drop several other charges.

Prosecutors say the 44-year-old Damien had sexual contact with the girl from December 2008 through July 2009. Authorities say they lived in the same house and the girl would wake up in the middle of the night with Damien on top of her.

Damien’s lawyer tells the Bangor Daily News ( ) that his client wanted to spare the girl the pain of testifying at trial.

He faces up to five years in prison at sentencing on Wednesday.