(CNN) -- A Pennsylvania judge on Thursday ordered a suburban Philadelphia county clerk to comply with the state's same-sex marriage ban and stop issuing marriage licenses to gay couples.
Since July, D. Bruce Hanes, the elected Montgomery County register of wills, has given out 174 licenses to same-sex couples, ignoring a 1996 state law that defines marriage as "between one man and one woman."
The state Department of Health sued to stop Hanes, saying he is in "direct defiance" of the ban and "risks causing serious and limitless harm to the public."
In his order Thursday, the judge said Hanes must "cease and desist from issuing marriage licenses to same-sex applicants, from accepting the marriage certificates of same-sex couples, and from waiving the mandatory three-day waiting period." He also denied dozens of requests from same-sex couples in the state to intervene in the lawsuit.
Hanes told CNN in August that he and his solicitor reviewed the state constitution and decided that language about civil rights, happiness and liberty applied to same-sex couples who want to get married.
"We've either got to change the constitution -- permit discrimination on the basis of sex, permit civil rights to be frustrated -- or change the interpretation of that marriage act or change the marriage act. You can't have it both ways," he said in August.
Hanes started issuing the licenses shortly after the U.S. v. Windsor case, in which the U.S. Supreme Court struck down a key part of the federal Defense of Marriage Act, which defined marriage as only between a man and a woman.
Pennsylvania is considered a conservative state on the issue of same-sex marriage, and it is simultaneously fighting a court battle with the American Civil Liberties Union, which sued the state in July after the U.S. Supreme Court ruled on the Windsor case.
The state attorney general, Kathleen Kane, said this year that Pennsylvania's ban on same-sex marriage is "wholly unconstitutional" and that she won't defend the state in the ACLU suit.