By Brendan O'Brien

MILWAUKEE (Reuters) - A federal judge deemed Wisconsin's ban on same-sex marriage unconstitutional on Friday to the delight of gay couples who immediately began rushing to county offices to wed as word of the ruling spread.

The ruling marked the latest in a string of decisions by federal judges who have struck down gay marriage bans in a number of states, although the Wisconsin ruling sparked some confusion over whether such marriages could now legally go ahead.

Clerks in two counties issued marriage licenses to same-sex couples on Friday night, and in response Wisconsin's attorney general filed an emergency motion asking the judge to stay her ruling.

U.S. District Judge Barbara Crabb ruled that a state constitutional amendment banning gay marriage, which Wisconsin adopted in 2006, violates gay couples' fundamental right to marry and their equal protection rights under the U.S. Constitution.

"Quite simply, this case is about liberty and equality, the two cornerstones of the rights protected by the United States Constitution," Crabb wrote.

Milwaukee County issued 68 marriage licenses to same-sex couples on Friday. Its courthouse stayed open late to allow couples to wed and 66 marriages were performed.

Another 61 marriage licenses were issued to gay couples in Dane County, which includes the state capital, Madison.

"We will continue to defend the constitutionality of our traditional marriage laws and the constitutional amendment, which was overwhelmingly approved by voters," State Attorney General J.B. Van Hollen said in a statement.

CROWDED COURTHOUSE

At the Milwaukee County courthouse, Matt Schreck, 37, and Jose Gutierrez, 35, both from Milwaukee, were the first same-sex couple married on Friday.

"It's amazing, I get to be with my best friend for the rest of my life," Schreck said.

Dozens of people crowded inside the courthouse to be married, amid clapping and tears, including Pat Cline, 51, and Patty McKenzie, 46, both from Oak Creek, Wisconsin.

Story continues

"We never thought this day would happen. It's overwhelming," Cline said. The pair had planned to go to PrideFest Milwaukee, but decided to get married instead.

The Milwaukee County clerk plans to be open Saturday to issue marriage licenses to gay couples from 9 a.m. to 1 p.m. and the Dane County clerk from 9 a.m. to 5 p.m.

Challenges to state bans on same-sex marriage gathered momentum last June when the U.S. Supreme Court struck down parts of the U.S. Defense of Marriage Act, ruling that legally married same-sex couples were eligible for federal benefits. Not including Wisconsin, same-sex marriage is now legal in 19 states plus the District of Columbia, and the number of states could grow sharply if federal court rulings striking down bans in several states are upheld on appeal. On Friday, seven same-sex couples filed a federal lawsuit challenging North Dakota's ban on same-sex marriage. North Dakota was the last state where a ban on same-sex marriage still in effect had not been challenged.

(Reporting by Brendan O'Brien; Editing by Cynthia Johnston, Sandra Maler and Michael Perry)