CANBERRA, Australia (AP) — Provincial lawmakers for the territory that includes Australia's capital voted Tuesday to allow same-sex marriage, a first for the country, but the federal government says it will try to stop gay weddings from happening.

The parliament of the Australian Capital Territory passed the law in a 9-8 vote, drawing a standing ovation from the 200-strong crowd in the parliament's public gallery. Many sang John Paul Young's 1970s pop hit "Love is in Air," in celebration.

Gay couples are expected to rush to Canberra, the national capital and the territory's only city, to tie the knot before the federal government can overturn the law, either through a court ruling or a federal parliamentary vote. Barring such obstacles, same-sex marriages could begin in December.

The conservative Liberal Party is in the opposition in the provincial parliament but led a coalition victory to win back the national government in elections last month.

Federal Attorney General George Brandis said his government has legal advice that the legislation is invalid.

"Irrespective of anyone's views on the desirability or otherwise of same-sex marriage, it is clearly in Australia's interests that there be nationally consistent marriage laws," Brandis said in a statement confirming the legal challenge.

Australian Capital Territory Chief Minister Katy Gallagher refused a request from Brandis to wait on allowing any same-sex marriages until the High Court ruled on the law's constitutional validity.

Rodney Croome, national director of the gay lobby group Australian Marriage Equality, said at least 500 Australian gay couples from outside Canberra want to marry there as soon as possible. Only about 360,000 of Australia's 23 million people live in the territory.

Croome described any federal intervention as cruel.

"It's cruel of the federal government to try to undo solemn vows of lifelong commitment made by the couples who will marry under this law," Croome said.

"Those vows bring great joy to those couples and their families and do no one any harm. Why would anyone want to undo them?" he added.

Australian federal law was amended in 2004 to specify that marriage can only be between a man and a woman. But it also specifically applied to heterosexual couples, and some lawyers argue that leaves states free to legislate for same-sex marriage.

Around 15 countries, including Australia's near neighbor New Zealand, and 14 U.S. states allow gay marriage.

Prime Minister Tony Abbott opposes gay marriage and his coalition last year thwarted two federal bills that would have allowed legal recognition of same-sex relationships.

His sister Christine Forster disclosed on Nine Network national television on Tuesday that she is engaged to her partner of six years, Virginia Edwards. Forster said they would not marry until they could do so in their hometown of Sydney.

Forster said her brother supports her relationship, but the siblings disagree over whether same-sex relationships should be legally recognized as marriages.

"He's always said: 'Well, I'll be there at the wedding, Chris,'" Forster told Nine.

Constitutional lawyer George Williams, of the University of New South Wales, said there were no precedents to suggest which government would likely win the High Court case. "It's a genuinely open question," said.

Federal Parliament could also pass legislation to remove the Australian Capital Territory law, but the ruling coalition holds a majority only in the House of Representatives, not the Senate, which would also need to approve the reversal.