A gay man to whom Rowan Kentucky county clerk Kim Davis nearly three years ago refused to issue a marriage license has lost his primary bid to run against her.

According to the AP, David Ermold on Tuesday lost his bid for the Democratic nomination to Elwood Caudill. Caudill will now face Davis in the general election.

Davis became a Christian celebrity when she refused to obey the Supreme Court's June 2015 ruling that found that gay and lesbian couples have a constitutional right to marry. She told Ermold and his now husband David Moore that her office was not issuing marriage licenses to gay couples on the “authority of God.” Davis served five days in jail after she was declared in contempt of court for ignoring a court order requiring her office to begin issuing marriage licenses to all couples.

Ermold, who teaches English at the University of Pikeville, had out-raised Caudill by at least $200,000.

Davis, who has worked in the clerk's office for nearly three decades, was elected county clerk in 2014 as a Democrat, but has since switched her registration to Republican.