A Maine man who sexually assaulted a 14-year-old girl and hid a camera in a tanning booth in Biddeford hoping to secretly record a woman was sentenced this week to serve 12 years in prison.

Joseph A. Flister, 36, whose most recent addresses were in Biddeford and Portland, was sentenced Tuesday in York County Superior Court in Alfred after pleading guilty to five counts of gross sexual assault, five counts of sexual exploitation of a minor and 10 counts of violation of privacy by installing a recording device in a private place.

Flister committed the sex crimes and some of the privacy violations in 2012.

The privacy violations came in connection with the tanning booth camera incidents from Jan. 1- 23, 2013, according to the District Attorney’s Office.

Justice Paul Fritzsche gave Flister a 20-year sentence, with all but 12 years suspended, and 12 years of probation. The judge also ordered Flister to register as a sex offender, have no contact with the victims, have no contact with children under 16 and not to possess sexually oriented material.

The case started with a call from a female employee at a fitness center who reported in January 2013 that she found what she thought was a hidden camera in a private tanning booth. Police found what appeared to be a key fob hanging from the wall near the ceiling.

The woman said she was suspicious of Flister, a co-worker, and told him a day earlier that she would be tanning after work, as she usually did. She checked the room before she told him she would be using it, then found the fob hanging from the wall when she returned to the room, police said.

She then told him that she was too tired to tan that day. The next day, she again told him that she planned to tan after work, she told police, and he said he had to clean the room first. When she checked the room, the fob was there again, police said.

Flister was fired that night.

Police later determined that the fob was a miniature recorder and saw Flister activating it because his reflection was visible in a mirror that was recorded by the device. Police got a search warrant and seized computers and recording devices from his house at 27 Emery St. in Biddeford.

Police said last year that there is no evidence Flister recorded anyone in the tanning booth.

Police said they also seized recordings of Flister’s alleged sexual interaction with the 14-year-old girl in 2012 and of other people having sex, which he apparently recorded with hidden cameras.