Kim Davis, the Kentucky clerk whose refusal to sign marriage certificates for same-sex couples grabbed national headlines in 2015, has lost her bid for re-election to the Rowan County clerkship. The Republican lost to Democrat Elwood Caudill Jr., 54 percent to 46 percent.

With all 19 precincts reporting, preliminary results show Caudill earned 4,210 votes to Davis' 3,566.

It was Davis' first time facing re-election since her fight against same-sex marriage landed her briefly in jail in 2015. She had defied the Supreme Court's ruling that year in Obergefell v. Hodges, the landmark decision that legalized same-sex marriage nationwide, explaining that distributing marriage licenses to such couples went against her beliefs as a member of the Apostolic Church.

Her refusal quickly became a lightning rod of controversy, drawing support from social conservatives and anger from same-sex-marriage advocates. Held in contempt for declining to fulfill a key pillar of her duties as county clerk, Davis found herself thrown in jail for several days — and all the while, demonstrators across the political spectrum descended on the small county of some 23,000 people.

When she was released in September 2015, a large rally of conservatives — including former Arkansas Gov. Mike Huckabee — was there to greet her.

These days, her national profile has diminished, though she has retained enough cultural cachet to campaign against same-sex marriage beyond U.S. borders. Just last year, Davis flew to Romania to push for a change to the country's constitution that would define marriage as specifically between a man and a woman.

Now, back at home, Davis is out of a job.

Her victorious opponent, Caudill, inevitably got caught up in the swirling controversy around same-sex-marriage licenses as well. Caudill's rival in the Democratic primary earlier this year, David Ermold, was one of the men whom Davis had denied a license in 2015. Despite dramatically outraising Caudill, Ermold failed to win the nomination.

But after Ermold's loss, he refused to throw his support behind his fellow Democrat, asserting in a Facebook post this summer that Caudill was an anti-gay bigot.

Copyright 2018 NPR. To see more, visit http://www.npr.org/.