Commonwealth Court Judge Dan Pellegrini said Montgomery County Register of Wills D. Bruce Hanes did not have the power to decide on his own whether Pennsylvania's same-sex marriage ban violates the state constitution.
"Unless and until either the General Assembly repeals or suspends the Marriage Law provisions or a court of competent jurisdiction orders that the law is not to be obeyed or enforced, the Marriage Law in its entirety is to be obeyed and enforced by all commonwealth public officials," Pellegrini wrote.
It was not immediately clear what the decision would mean to those who have already received a license.
The state Health Department under Republican Gov. Tom Corbett sued Hanes after he began issuing licenses to same-sex couples in July, despite a 1996 state law that defines marriage as between a man and a woman. The department argued that Hanes' actions could create chaos.
James Schultz, Corbett's general counsel, issued a statement saying the key issues was whether local officials can decide which laws to uphold or reject, based on their personal legal opinion.
"We respect the interests and dignity of all the parties involved in this case, but we are a government of laws and it is important that all office holders across the state enforce those laws uniformly," Schultz said.
A Montgomery County spokesman said the ruling was being analyzed and they planned to comment later in the day.
Hanes, a Democrat and an elected official whose duties include marriage licenses, said the law conflicts with his constitutional obligations. His actions followed the U.S. Supreme Court's decision to throw out part of the federal Defense of Marriage Act, and a statement by Pennsylvania Attorney General Kathleen Kane that the same-sex marriage ban was unconstitutional.
Pellegrini wrote that only courts have the power to determine if a statute is unconstitutional.
"In this case a clerk of courts has not been given the discretion to decide that a law ... he or she is charged to enforce is a good idea or a bad one, constitutional or not," the judge wrote. "Only courts have the power to make that decision."
Marcus Saitschenko of Philadelphia, who obtained a license from the clerk to wed his longtime partner, said he has faith in the legislative and judicial process.
"I'm confident that we will have marriage equality in Pennsylvania soon," Saitschenko wrote in an email Thursday. "When my partner and I are legally able to be married in our home state, we will do so."
Pennsylvania is the only northeastern state that does not grant legal status to marriage or civil unions between individuals of the same sex. Hanes has issued 174 licenses to same-sex couples.
A separate challenge to Pennsylvania's same-sex marriage ban is pending in federal court.
A similar scenario is playing out in New Mexico, where a county clerk concluded the law did not prevent him from issuing same-sex licenses, and about a half-dozen others in that state have followed suit.