Failed presidential candidate Mike Huckabee is paying $25,000 for playing "Eye of the Tiger" at a rally last year without the band's permission, CNNMoney has discovered.

Huckabee played the triumphant song by the band Survivor at a rally he held for Kim Davis, the Kentucky county clerk who refused to issue marriage licenses to same-sex couples.

But Huckabee never paid for the rights -- so his campaign got sued for copyright infringement.

He recently agreed to a confidential settlement with Rude Music. That company is owned by the Survivor guitarist who cowrote the song, Frankie Sullivan.

They settled out of court, and it came to light when Huckabee listed the $25,000 cost as a campaign expense on federal election records. A payment to Rude Music is listed as a "legal settlement" for "copyright infringement."

Huckabee paid half of it in May and listed the $12,500 payment as an "itemized disbursement." He listed the other half as "debts and obligations." Both appear on a June 20 filing.

Huckabee ran for the Republican ticket until he dropped out Feb. 1, but he's still paying off the cost of his campaign.

The former Arkansas governor has tried to avoid paying the fees.

In court, Huckabee argued that the anti-gay-rights rally was a "religious assembly... signifying joy and praise at the release of Mrs. Davis" from jail. A religious event would classify the act of playing the song as "noncommercial" and allow him to cite "fair use" -- letting him play part of the song without paying for it.

Related: Bernie Sanders' folk album enjoys a sales surge

But that argument fell apart when the songwriter's lawyer pointed out that Huckabee claimed the rally as a presidential campaign expense.

He is now petitioning the Federal Election Commission to let him start a separate legal defense fund to pay off the settlement. However, the FEC just issued a draft opinion last week saying Huckabee should pay the costs himself.

Huckabee's campaign and lawyers did not respond to CNNMoney's request for comment over the weekend.

The musician's attorney, Annette McGarry, said the settlement bound them to silence about the case.

However, she noted that this isn't the first time a politician has tried to use "Eye of the Tiger" without permission.

Republican politician Newt Gingrich got sued in 2012 after using the song at political rallies for years, and he settled for an unlisted amount of money. Mitt Romney's 2012 presidential campaign quickly stopped using the song after receiving a warning, McGarry said.

"The 'Eye of the Tiger' copyright is a very valuable asset, and we work very hard to protect it," said McGarry, an intellectual property lawyer in Chicago.