(Adds comment, colour)
SYDNEY, Dec 7 (Reuters) - Australia became the 26th nation to legalise same-sex marriage on Thursday, prompting cheers and singing from a packed parliament public gallery in a country where some states ruled homosexual acts to be illegal until just 20 years ago.
Lawmakers, who had cast aside a conservative push to allow religious objectors to refuse service to same-sex couples, waved rainbow flags and embraced on the floor of the chamber, after the overwhelming vote in favour of the bill.
Fewer than five of 150 MPs voted against it.
"What a day. What a day for love, for equality, for respect," said Prime Minister Malcolm Turnbull. "It is time for more marriages."
The law, which will also recognise same-sex marriages solemnised in foreign countries, takes effect from Saturday. Because a month's notice is required for the state to recognise a marriage, the first legal same-sex unions will be in January.
Five-time Olympic gold-medal winner, the swimmer Ian Thorpe, who came out in 2014, said the law reflected contemporary Australia and would support people identifying as lesbian, gay, bisexual, transsexual queer or intersex (LGBTQI).
"It will give each of us the sense of what modern Australia is, and is, in fact, the way that most of us see this country as being, and will allow LGBTQI people in our nation to know that fairness is one of our values," he told reporters in Canberra.
Australians had overwhelmingly endorsed legalising same-sex marriage in a postal survey.
"What a moment for the country," said Christine Forster, a Sydney councillor and the sister of former Prime Minister Tony Abbott, standing among throngs of rainbow-clad campaigners for a "Yes" vote, outside parliament with her female partner.
She said she planned to go to her brother's house to celebrate.
Abbott, who is still a member of parliament, was one of the most prominent "no" campaigners. He left the chamber before the vote.
The bill cleared the upper house last month.
During the debate in the lower house on Monday, a politician proposed to his same-sex partner.
Both Turnbull's Liberal-National coalition government and the main opposition Labor Party had said they wanted to pass it by Dec. 7.
But despite the support of the main parties, religious organisations and conservative lawmakers had voiced strong opposition and proposed dozens of amendments.
During the debate, they pressed for broad protections for religious objectors, among them florists and bankers, to refuse service to same-sex couples.
But their efforts were rejected.
"These amendments, rather, are a shield for people and organisations that hold to a traditional view of marriage. They are not a sword to be wielded in the service of bigotry," government MP Andrew Hastie said in parliament.
Amendments to permit lay celebrants to decline to solemnise same-sex marriages and businesses opposed to the unions to refuse service at wedding receptions were all defeated, one after the other, during three days of debate.
"Love has won, and it's time to pop the bubbly," Greens MP and same-sex marriage supporter Adam Bandt said. (Reporting by Tom Westbrook; Editing by Nick Macfie, Robert Birsel)
Our Standards: The Thomson Reuters Trust Principles.