Hanes had argued that the law was unconstitutional, so he could not be compelled to enforce it. Pellegrini said this case was not the appropriate legal venue for constitutional arguments.
James Schultz, general counsel for the Corbett administration, praised the ruling.
"The key question in this case has been whether any local official, anywhere in Pennsylvania, has the ability to decide which laws to uphold and which laws to reject based on their own personal legal opinion," Schultz wrote in a statement Thursday.
Pellegrini also denied a request to intervene by same-sex couples who had received licenses. They wanted to argue that this case would affect the validity of their marriages.
The 35-page ruling did not address the status of the 118 same-sex marriages already completed in Pennsylvania - a move applauded by State Sen. Daylin Leach (D., Montgomery), among the legislature's most ardent supporters of same-sex marriage.
"It said nothing about couples already married, which is at least a victory for those couples and for marriage equality in Pennsylvania," Leach said.
For 56 couples who received marriage licenses but had not yet wed, Pellegrini's ruling means the window to file completed marriage certificates has closed.
Marcus Saitschenko and James M. Goldstein of Philadelphia obtained a marriage license July 24 but had not yet held a wedding ceremony.
Saitschenko said Thursday he was disappointed by the ruling but added: "I do continue to have faith in the process. There's other litigation, the ACLU suit, and this Commonwealth Court suit is likely to be appealed. I have faith that it will be overturned eventually."
Supporters of same-sex marriage, including Hanes, the Democratic Montgomery County commissioners, and same-sex couples and their relatives expressed similar optimism that a court would eventually come down on their side.
"After having issued 174 marriage licenses . . . and having talked with many of those couples, I am more convinced today that I am on the right side of history," Hanes said Thursday.
He said he would comply with the judge's ruling and consult with his attorneys on whether to appeal to the state Supreme Court.
Meanwhile, opponents vowed to create a more organized movement against same-sex marriage in Pennsylvania.
"We're not going away just because the judge ruled correctly in this case," said Mike McMonagle of the Pro-Life Coalition of Montgomery County.
The legislature in 1996 banned same-sex marriage and refused to recognize such unions performed in other states.
After Hanes began issuing the licenses in July, the state Health Department sued.
During the Sept. 4 hearing in Harrisburg, Pellegrini said he was reluctant to get into the "complexities" of the same-sex marriage debate.
Instead, the arguments focused on procedural questions such as whether Hanes, as both register of wills and clerk of Orphans Court, falls under the judicial branch or the executive branch.
Another issue was whether the Health Department had standing to sue. Montgomery County Solicitor Ray McGarry argued that the department suffered no provable harm, since it merely collects forms and statistics related to marriage.
Pellegrini's ruling rejected all of the county's defenses, finding that the case was in the proper jurisdiction and that the Health Department had both explicit and implicit standing to defend the Marriage Law.
Leach said he was disappointed that Pellegrini did not allow Hanes to use constitutionality as a defense. "I find it odd that the judge says Hanes is not allowed to interpret the Constitution," said Leach, "when [Hanes] is required by law to defend the Constitution."
In the hearing last week, Pellegrini indicated that questions of constitutionality would be handled more appropriately in a federal lawsuit challenging the Pennsylvania statute.
The federal case is pending, and colead counsel Mark Aronchick said arguments should be scheduled in a few weeks. Another lawsuit filed Sept. 6 challenges the marriage law as violating the state Constitution.
Neither of those cases will be affected by Pellegrini's ruling.
Same-Sex Marriage in Pa.
1996: The legislature bans same-sex unions and refuses to recognize such unions performed in other states.
June 26, 2013: The U.S. Supreme Court strikes down the federal Defense of Marriage Act in Windsor v. United States. The court says a federal ban on same-sex unions is unconstitutional because "regulation of domestic relations" is "a virtually exclusive province of the states."
July 9: Same-sex couples sue Pennsylvania, challenging the constitutionality of a 1996 law defining marriage as "a civil contract by which one man and one woman take each other for husband and wife." The lawsuit, Whitewood v. Corbett, is filed in federal court and relies heavily upon the Supreme Court's language in Windsor.
July 11: Pennsylvania Attorney General Kathleen Kane, left, announces that she will not defend the state in Whitewood because she believes the same-sex marriage ban is "wholly unconstitutional."
In a raucous news conference at the National Constitution Center, Kane says: "We are the land of the free and the home of the brave, and I want to start acting like that."
Pennsylvania Republicans immediately denounce Kane for what they say is a dereliction of duty. "What law will she ignore next?" wondered state GOP Chairman Rob Gleason, who called it unacceptable for the Democratic attorney general "to put her personal politics ahead of her taxpayer-funded job by abdicating her responsibilities."
July 23: Montgomery County Register of Wills D. Bruce Hanes, above, says he also believes Pennsylvania's marriage law is unconstitutional, and will not deny licenses to gay and lesbian couples. "I decided to come down on the right side of history and the law," Hanes said.
July 24: Five couples from Montgomery County, Philadelphia, and Chester County go to Hanes' office to request marriage licenses. One couple obtain a waiver on the typical three-day waiting period so they can be married that morning.
July 30: The state Department of Health files suit, asking Commonwealth Court to block Hanes from issuing any more licenses or accepting marriage certificates from gay and lesbian couples. The lawsuit alleges that Hanes "risks causing serious and limitless harm to the public," citing "administrative and legal chaos," and couples "left to believe erroneously that they have entered into a valid marriage under the law of Pennsylvania."
July 30: Montgomery County promises to defend Hanes, but says that until a court intervenes, he "will continue to issue marriage licenses to same-sex couples."
Aug. 3: Montgomery County responds to a state lawsuit that seeks to block it from issuing marriage licenses to same-sex couples. The county contends that the Health Department lacks legal standing to uphold state laws, including the gay-marriage ban. The filing also asserts that Pennsylvania's Marriage Law is unconstitutional on the state and federal levels because it discriminates against a class of people.
Aug. 7: Commonwealth Court agrees to an expedited review of the case, but does not bar the county from issuing more licenses in the meantime.
Aug. 9: Montgomery County issues its 100th marriage license to a same-sex couple.
Aug. 13: Thirty-two same-sex couples that have received marriage licenses petition to participate in the state lawsuit. They argue that the case "may substantially impact [their rights] and determine the validity of their marriages."
Aug. 27: New Hope Mayor Larry Keller, citing his duty as an elected official to uphold the law, declines to officiate at a same-sex wedding for a couple who had obtained a marriage license in Montgomery County.
Aug. 29: The Corbett administration files a motion against the couples' request to intervene. It asserts that their marriages are not valid and thus, just like "12-year-olds" who are barred from marrying under state law, these couples have no standing to participate.
Aug. 30: Responding to a flood of anger over state attorneys' mention of gay couples and "12-year-olds," Gov. Corbett steps back from that statement. He says his attorneys used "an inappropriate analogy," but also says the media took it out of context.
Sept. 4: Commonwealth Court President Judge Dan Pellegrini hears approximately one hour of arguments in the case. He says constitutionality will not be discussed, and indicates that he will rule "as soon as I can."
Last Friday: A lesbian couple file a lawsuit directly challenging the Pennsylvania marriage law as conflicting with the state constitution.
Thursday: Pellegrini orders Hanes to immediately stop issuing marriage licenses and marriage certificates. Hanes says he is disappointed and considering an appeal but will "fully comply" with the ruling.
Around Sept. 30: A judicial meeting is scheduled on the federal Whitewood case. A hearing schedule is expected to follow soon after.
Oct. 7: The state has until this date to respond to Cucinotta v. Commonwealth, the lawsuit challenging the marriage law on state constitutional grounds.
- Jessica Parks
Contact Jessica Parks at email@example.com, 610-313-8117, or follow on Twitter @JS_Parks.
Inquirer staff writers Amy Worden and Angela Couloumbis contributed to this article.