Canberra, Australia (CNN) - Australia's Parliament voted to legalize same-sex marriage Thursday after years of political jockeying and fierce public debate.
Cheers and applause broke out as lawmakers voted in favor of the bill following hours of debate and emotional speeches at Parliament House in Canberra.
"This is Australia: fair, diverse, loving and filled with respect for everyone," said an effusive Prime Minister Malcolm Turnbull, as he introduced the bill for a final vote.
"This is a great day, it belongs to every Australian."
The bill passed its third reading with only four members of Parliament in opposition.
The parliamentarians who voted in favor of same-sex marriage took time to let the jubilant moment sink in, celebrating with hugs and handshakes and proudly sporting rainbow-colored clothing.
In a particularly poignant moment, the ministers on the House floor and guests in the gallery began singing "I am, you are, we are Australian."
The move follows a two-month national postal survey that showed 61% of more than 12 million respondents were in favor of marriage equality.
The country is now the 24th in the world to allow same-sex couples to marry, according to Pew Research.
Australia's first same-sex weddings will not take place until at least January, however, because of a longstanding requirement for all Australian couples to provide a full month's notice of their intention to get married.
Marriage equality campaigners have fought for years for Thursday's vote. Though the bill was expected to pass into law without significant opposition, the lengthy legislative process was excruciatingly slow for the hundreds of advocates watching from the public gallery.
Among them was Christine Forster, the gay sister of Tony Abbott, the former Australian Prime Minister who has long been seen as the face of the "no" campaign.
Forster was joined in the public gallery by her partner, Virginia Edwards. They plan to marry next year, and Abbott has said he'll attend despite his personal views.
Abbott and other conservatives proposed amendments to the bill to include further religious protections, all of which were voted down.
"These amendments are important and I stress they are not against same-sex marriage, they are simply in favor of the rights of religious organizations to keep doing what they're doing," Abbott said.
Opponents of the changes argued they would legalize discrimination against the gay community. The 500 or so people in the gallery were vocal in their disapproval of the amendments. They were warned multiple times that parliamentary rules prohibit them from making noise and even applauding.
An emotional week
After the bill passed the Senate last week, House proceedings kicked off with fireworks Monday when Liberal MP Tim Wilson surprised his colleagues by proposing to his longtime partner Ryan Bolger.
The next day, Liberal MP Andrew Wallace, who is a devout Catholic, shared with his colleagues how his gay daughter helped change his position on same-sex marriage.
"She said: Dad, in the years to come, my generation will look back and judge your generation about how you deal with the issue of homosexuality in the same way that your generation considered your parents' generation in the way that they dealt with our indigenous people," Wallace said.
Fighting back tears, Liberal MP Sarah Henderson told the story Wednesday night of a close gay friend of hers who died months ago and who, in one of their last conversations, asked her to continue to push for same-sex marriage.
Survey says yes
Thursday's vote comes three weeks after the Australian public voted overwhelmingly to legalize same-sex marriage as part of a national postal survey lasting two months.
Under political pressure to find a solution, the ruling Liberal National Coalition government announced the non-compulsory survey in August, saying if the result was "yes" they would allow a free vote in Parliament.
In the end, 61.6% of Australia voted in favor of allowing same-sex marriage, with 38.4% saying "no."
About 12.7 million people participated in the survey, which had a response rate of nearly 80% -- which is considered very high.
Australians have long been in favor of same-sex marriage, with polling from as long as 10 years ago showing majority support for legalizing marriage equality.