FRANKFORT, Ky. — A federal judge has ordered Kentucky taxpayers to pay more than $220,000 in legal fees because a county clerk refused to issue marriage licenses to same-sex couples in 2015.

U.S. District Judge David Bunning on Friday ordered the state to pay $222,695 in fees to the attorneys of two same-sex couples and others who sued Rowan County Clerk Kim Davis for refusing to give them marriage licenses. He also awarded $2,008.08 in other costs. Bunning said the county and Davis herself did not have to pay.

“Davis represented the Commonwealth of Kentucky when she refused to issue marriage licenses to legally eligible couples. The buck stops there,” Bunning wrote.

But Davis’ attorney said she will appeal the ruling anyway. The judge ruled Davis lost the case. Attorney Mat Staver said they did not lose. He said the case was dismissed as moot after the state legislature changed the law in 2016 to remove the names of county clerks from marriage licenses.

If the appeal succeeds, Staver said, state taxpayers would not have to pay legal fees because that money can only be awarded to a “prevailing party.”

William Sharp, legal director for the ACLU of Kentucky, said he hopes the ruling reminds Kentucky officials that “willful violations of individuals’ civil liberties … will not only be challenged but will also prove costly.”

“It is unfortunate that Kentucky taxpayers will likely bear the financial burden of the unlawful actions and litigation strategies of an elected official, but those same voters are free to take that information into account at the ballot box,” Sharp said.

While Davis plans to appeal, state officials have not decided. A spokesman for Gov. Matt Bevin said the state’s outside counsel is reviewing the decision.

A U.S. Supreme Court decision effectively legalized same-sex marriage nationwide in the summer of 2015, setting off joyous celebrations among gay rights advocates nationwide. But just hours after the decision, Davis’ announcement that she would stop issuing marriage licenses transformed the tiny town of Morehead into the front lines of the culture war. The angry demonstrations that erupted from both sides were captured on national television as the dispute dragged on for months.

The case reached its zenith after a judge sent Davis to jail for refusing his order to issue the licenses. When she was freed five days later, two Republican presidential candidates were there to greet her along with thousands of supporters, including a church choir.

Davis’ office subsequently issued modified marriage licenses that did not include her name. In the spring of 2016, Kentucky’s new Republican governor signed a law removing the names of county clerks from marriage license forms. Davis said that satisfied her concerns.

A federal appeals court dismissed the case and ordered Bunning to vacate his previous order granting the couples a preliminary injunction. Staver said that means Davis did not lose the case. But Bunning disagreed, saying Davis’ office only issued the marriage licenses after the court ordered her to do it.

“There are no voluntary actions by Davis that would suggest the material alteration of the parties’ legal relationship was anything other than court-ordered,” Bunning wrote.