MILWAUKEE — Dozens of gay couples got married at courthouses in Milwaukee and Madison early Saturday, taking advantage of what may be a small window in which to get hitched before the state’s same-sex marriage ban is reinstated, at least temporarily.

Milwaukee County Clerk Joe Czarnezki said couples were lined up outside his courthouse at 6 a.m., three hours before it opened. Within 30 minutes of opening, about 45 couples had applied for marriage licenses.

U.S. District Judge Barbara Crabb issued her ruling Friday afternoon just as the gay festival PrideFest was starting in Milwaukee.

Craig Cook and Marshall Draper arrived about 8:30 a.m. and found nearly two dozen couples in line ahead of them. Cook, 43, said he and others had been hoping Crabb would make a decision in time for PrideFest. He and Marshall planned to go back to the festival Saturday after being married by a Unitarian minister outside the courthouse.

“Had this been legal, we probably would have done this 20 years ago,” Cook said. He said he and Marshall would likely have a reception in a few weeks, but “this was as formal a wedding as I’ve ever wanted.”

Rachel Arbit , 27, and Ashley Norris, 30, tried to get married Friday evening but arrived at the Milwaukee courthouse to find they needed Arbit’s birth certificate and Social Security card, both of which were in a safe deposit box at a bank three hours away. They returned to the courthouse Saturday morning and waited for Arbit’s mother to arrive with the documents.

“We don’t know how long it’s going to last, this ruling,” Norris said. “And we don’t want to miss out.”

While Crabb declared Wisconsin’s ban on same-sex marriage unconstitutional, she did not order the state to allow such marriages. Instead, she asked the couples who sued to describe exactly what they wanted her to block in the gay marriage law.

Attorney Larry Dupuis, who represented the couples who sued, said the American Civil Liberties Union would respond to Crabb’s request this week and he expected her to explicitly order marriages to begin after that.

Meanwhile, Republican Attorney General J.B. Van Hollen asked Crabb on Friday to issue an emergency stay halting the issuing of further marriage licenses to same-sex couples. He was expected to petition a federal appeals court for a similar order Monday.