A veteran California sex crimes detective who had been accused of raping a 15-year-old sexual assault victim after he was assigned to investigate her complaint has pleaded guilty to two felonies.

Neil Kimball, 46, pleaded guilty in Ventura County to a lewd act with a child and unlawful sexual intercourse, prosecutors said Wednesday. As part of the plea agreement, Kimball, of Agoura, Calif., faces a three-year sentence in prison. He also has to register as a sex offender.

When he was arrested in November, Kimball was charged with tying up and raping the girl during an incident in Camarillo in 2017.

EX-ARIZONA TEACHER SENTENCED TO 20 YEARS IN PRISON FOR SEX WITH STUDENT

“Based on our investigation, we believe the charges he pled guilty to best fit the crimes he committed,” prosecutor Patrice Koenig said, according to the Ventura County Star.

Mugshot for Neil Kimball, 46.

Mugshot for Neil Kimball, 46. (Los Angeles County Sheriff's Department)

Kimball’s defense attorney Doug Ridley declined to comment, the paper reported.

The detective investigated dozens of child molestation cases as a member of the Los Angeles County Sheriff Department’s sex crimes unit, The Los Angeles Times reported.

Kimball was assigned to the unit in 2013. He had 20 years on the job with the sheriff’s office.

ALABAMA MAN SENTENCED TO MORE THAN 600 YEARS IN JAIL FOR SEX CRIMES

A colleague was working Kimball’s cases when he learned of the rape accusation in October, the paper reported. Kimball was on medical leave at the time.

The sheriff’s office said Friday that Kimball will be fired immediately, according to the paper. His pay was suspended in March.

CLICK HERE TO GET THE FOX NEWS APP

“We hold all our employees to the highest ethical standard and when that standard is not met there must be consequences,” the sheriff’s department said, the Times reported.