FAIRFIELD — The Board of Selectmen voted this week to approve the settlement in a case brought by former police detective Stephen Rilling, ending a saga that started almost 3 years ago.

Sources said the settlement is for just under $100,000. According to town attorney Jim Baldwin, the settlement would be paid for by the town’s insurance carrier. The agreement was reached before the case went to trial later before a jury later this month.

“The town agreed to approve the insurance company’s decision to settle, the cost of which will be borne by them,” First Selectwoman Brenda Kupchick said about the settlement. “Under the terms of the policy, the town really had no other choice.”

Rilling, the son of Norwalk Mayor Harry Rilling who was addicted to painkillers while working for the Police Department, claimed in the lawsuit against the town of Fairfield that his superiors put him in a position to steal thousands of dollars of heroin and Oxycotin despite his pleas to take him off narcotic cases.

The former detective also claimed that he was not allowed to retire on a disability — being addicted to the powerful painkillers.

A 19-year veteran of the department, Rilling agreed to a plea bargain in March 2018 and pleaded guilty to two counts of misdemeanor possession of narcotics and three counts of fourth-degree computer crime. He was sentenced to a suspended 5-year sentence with three years’ probation.

According to police, Rilling signed out more than 800 packets of Oxycotin, more than 225 folds of heroin and a few packets of cocaine from the departments evidence room between June 2016 and February 2017. They said he falsely claimed he needed to have the drugs tested while actually taking them for personal use because of his addiction.

The department said the drugs came from various raids and operations as well as from the homes of people who had overdosed.

In the lawsuit, Rilling claimed his addiction came from the use of prescribed opioids after an on-the-job car accident in 2009. He states in the suit that in 2013, he told his superiors in the department he was addicted to opioids and admitted himself to a drug treatment facility.

When he returned to work after treatment, Rilling claimed that he was ordered to resume his role investigating narcotics crimes — despite his protests — causing him to relapse. The suit claimed this decision led him to resume his use of opioids and resulted in his theft of Oxycotin, heroin and other narcotics from the evidence locker.