Kim Davis, the controversial Kentucky clerk who was jailed in 2015 over gay marriage licenses, lost her re-election bid on Tuesday to Democrat Elwood Caudill Jr.

Davis, a Republican, was defeated by Caudill, 54 percent to 46 percent, to serve a four-year term, according to The Associated Press.

FULL MIDTERM RESULTS 

Davis spent five days in jail for ignoring court orders to issue licenses to same-sex couples following a 2015 Supreme Court ruling allowing gay marriage. She argued that she was acting "under God's authority,” and was freed after a judge ordered her deputies to issue the licenses without her approval.

Davis has said she no longer objects to issuing the licenses to same-sex couples because Kentucky dropped a requirement that the licenses bear the clerk’s signature. She, however, has become a prominent opponent of such marriage, and even visited Romania last year to push that country to prohibit it through an amendment to its constitution.

MIDTERM LIVE BLOG 

Caudill, a 20-year employee of the county's property valuation office and a fourth-generation Rowan County resident, soundly defeated his Democratic challengers in the primary election. One of his challengers was David Ermold, to whom Davis refused to issue a license.

Ermold has since accused Caudill of being an antigay bigot.

"I just want him to lose. I would rather Kim Davis win," Ermold told AP in September. "At least Kim Davis has the integrity to stand up for what she believes in. Elwood Caudill is a liar."