The government's contentious religious discrimination bill has passed through parliament's lower house after a marathon all-night debate, but its future remains unclear.
In a huge victory for the opposition, five Liberal MPs crossed the floor to vote with Labor in support of a crossbench amendment to extend stronger protections to include transgender students.
Liberals Trent Zimmerman, Bridget Archer, Fiona Martin, Katie Allen and Dave Sharma all voted to repeal a section of the Sex Discrimination Act that allowed religious schools to discriminate against students on the grounds of both sexuality and gender identity.
Dozens of MPs on all sides took to the floor during an emotional debate that started long before sundown and finished in the early hours of the morning.
Waving a rainbow flag, Trent Zimmerman's voice cracked as he told parliament he would cross the floor to back Labor's amendments.
"I can honestly say this has been one of the most difficult weeks of my time in parliament," he said.
"I want to indicate I will be making the difficult decision to part with my party on some of the amendments before the chamber tonight.
The religious discrimination legislation aims to stop someone from being discriminated against because of their religious beliefs.
To garner support for that from moderate Liberals, the government had agreed to amend existing laws to prevent schools excluding students because of their sexual orientation
"I cannot stand by and do anything that makes their situation more difficult, which sends anything other than a message from this parliament, which most receive in their schools but sadly some don't, that we want to embrace you, we want to love you, we want to support you, we want to nurture you," Mr Zimmerman said.
Before the vote, Opposition Leader Anthony Albanese did his best to persuade other Coalition MPs to support the Sex Discrimination Act amendments.
"Australian families are going to wake up in a few hours and look on with sadness and anger if this does not occur."
During the debate on the religious discrimination bill, Labor tried to pass amendments to prevent discriminatory statements in the name of religion, with former leader Bill Shorten, now the Shadow Minister for the National Disability Insurance Scheme, speaking passionately about the issue.
"Some documented examples of current abuse are direct statements to people of disability that their disability is punishment from God for their or their parents' sins, or their disability can be healed by prayer or by living [virtuously], or that they deserve to suffer from their disability for what they have done in a previous life," he said.
The bill passed the House of Representatives with Labor's support just after 4am on Thursday after more than 10 hours of debate.
Prime Minister Scott Morrison appeared on the floor of the House of Representatives before the vote, saying he had hoped the bill would unite the House.
"During the course of this debate, the issue of transgender children and teachers has also been raised," he said.
"And there'll be a time and place to address that as well."
Mr Morrison also sought to appease some within his party by announcing a new parliamentary committee chaired by paediatrician and Victorian Liberal MP Katie Allen to examine the reforms.
Dozens of parliamentarians reflect on personal experiences
Dozens of MPs spoke to the bill, reflecting on different personal experiences.
Egyptian-Australian Labor MP Peter Khalil reflected on his own experience.
"As someone who has experienced discrimination in my own life — both personally and professionally — I know how important the principle of equality before the law is, and I know how important the principle of freedom of religion is," Mr Khalil said.
Some Labor MPs were frustrated they were even there in the first place.
After a parliamentary week featuring an apology to Brittany Higgins, the opening of international borders, and military support for aged care, religious discrimination has sucked up almost all of parliament's oxygen.
Labor MP Mike Freelander who represents Macarthur, a culturally and religiously diverse seat in south-western Sydney, told the ABC there were much more important issues at play.
"It's incredibly frustrating to me. There are a whole lot more things we should be looking at and should be trying to do, such as the Integrity Commission. Then there's a whole range of health issues that I think need to be properly aired and discussed, particularly aged care."
The religious discrimination bill passed with a final vote of 65-59.
The bill will now proceed to the Senate, where the government will decide whether to accept the amendments to the Sex Discrimination Act.
Labor will still pursue its amendments to the religious discrimination bill in the Upper House.
A new debate in the Senate?
Liberal senator Jane Hume told the ABC that despite the numbers in the Senate being less in favour of her party, she believed a balance would be struck that would allow the bill to pass.
"I'm absolutely certain that at the end of the day, when the bill passes both houses of parliament, that we'll land on the right decision, balancing freedoms and rights of people with deeply held religious beliefs and their desire, particularly, to send their children to a single-sex school, and making sure we protect the rights of all children as well," Senator Hume said.
Labor leader Anthony Albanese, also speaking to the ABC in the aftermath of the debate, said simply voting against the bill on the basis of his party's objections was not an option.
"I'm very proud of what we've managed to achieve," Mr Albanese said.
"And those people who argued that we should just vote no and not participate also ignored the fact that the issue of discrimination against people on the basis of their faith is real and it is something that Labor supports action on, just like we support removing discrimination on the basis of age, on the basis of gender, on the basis of disability.
"The amendment carried will prohibit schools discriminating on the basis of sexual orientation, gender identity, relationship, or marital status. That makes an enormous difference."