Australia's High Court has overturned legislation allowing gay marriage, invalidating wedding ceremonies performed in the five days since same-sex marriage became legal.

Around 20 gay couples had tied the knot since 7 December when Australia's first same-sex marriage laws came into force in the Australian Capital Territory.

"This is devastating for those couples who married this week and for their families," said Australian Marriage Equality National Director Rodney Croome.

The ACT parliament passed a bill in October making the territory the first part of Australia to legalise same-sex weddings.

But the national government challenged the decision, saying it was inconsistent with federal laws.

The court said the issue should be decided by parliament, which voted down gay marriage legislation in September 2012.