LEXINGTON, Ky. — Rebuked for further eroding public confidence in government, a former high-ranking official in Kentucky government was sentenced to nearly six years in prison Thursday for orchestrating a kickback scheme that netted him more than $200,000.

Tim Longmeyer apologized for the actions, which led to his shocking downfall and deeply embarrassed Kentucky’s former governor and current attorney general.

Longmeyer, 48, hatched the scheme while serving in former Democratic Gov. Steve Beshear’s administration. Beshear’s son, current Attorney General Andy Beshear, later hired Longmeyer as his top deputy. Longmeyer abruptly resigned days before his criminal case became public.

Longmeyer’s sentencing came about five months after pleading guilty to a bribery charge for using his influence as head of Kentucky’s Personnel Cabinet to steer contracts to a consulting firm in 2014 and 2015. He admitted to receiving more than $200,000 in kickbacks from the firm.

A remorseful Longmeyer spoke at his sentencing hearing. He stayed seated, facing U.S. District Judge Karen Caldwell. He apologized to the commonwealth, his family, federal authorities and state government employees, saying he had failed to follow his “moral compass.”

“There is no excuse for my actions,” he said.

The prosecution asked for 70 months; the defense argued for less than half of that.

Caldwell granted the prosecution’s request for the stiffer sentence, remarking that Longmeyer’s behavior “further erodes” public confidence in government.

She described him as a “good man who made a grievous mistake.”

Longmeyer also was ordered to pay $203,500 in restitution.

U.S. Attorney Kerry Harvey said Longmeyer gave in “to the temptations of greed.” He said the sentence was stiff enough to “deter others from falling into the same sort of trap.”

In a brief statement, Andy Beshear praised the FBI and federal prosecutors. “Individuals who violate the law must be held accountable,” he said.

Court documents state that the kickbacks were given in exchange for Longmeyer’s help in securing multimillion-dollar contracts with two insurers, Humana and Anthem Blue Cross Blue Shield. An FBI affidavit and federal prosecutors said Humana and Anthem were unaware of the scheme.

The consulting firm involved was identified as Lexington-based MC Squared. No one from the firm has been charged, but the investigation is continuing, authorities said.

During the scheme, Longmeyer received $197,500 in cash, prosecutors said. They said Longmeyer also directed some of the money generated from the scheme to Democratic candidates, including to Andy Beshear’s 2015 campaign for attorney general.

Federal prosecutors have said they have no evidence that either Steve or Andy Beshear were ever aware of Longmeyer’s illegal activities until the bribery charge became public.

The scandal proved an embarrassment to the Beshear family amid their ongoing feud with current Republican Gov. Matt Bevin.

After leaving the courthouse, Longmeyer called the Beshears a “wonderful family” and said: “I’m very sorry for anybody I’ve let down.”

As personnel secretary, Longmeyer oversaw the $1.8 billion Kentucky Employees Health Plan. Prosecutors said he pushed Humana and Anthem to hire MC Squared for such work as gauging member support for health plans. He then took kickbacks from the company.

Humana paid a total of $2 million to the consulting firm between 2011 and 2014, according to documents in the case.

Leading up to sentencing, Caldwell received letters pleading for leniency for Longmeyer.

The letter writers included the Rev. Joseph Batcheldor, a longtime family friend. He said the publicity generated by the case had already been “a lot of punishment” for Longmeyer.

“Taking a man away from his family for a long, long time — maybe for a shorter time would be better, in my mind,” Batcheldor said in a phone interview ahead of sentencing.

Caldwell ordered Longmeyer to report to prison in early December. After the hearing, Longmeyer was surrounded by relatives.

More fallout from the investigation occurred this week. The day before Longmeyer’s sentencing, a longtime Democratic activist and political consultant admitted in federal court that he participated in the kickback scheme.

Larry O’Bryan pleaded guilty Wednesday to three counts of bribery of a public official.

His sentencing was set for Jan. 19.