Lawmakers in the Assembly of the territory of New South Wales have OK'd a bill that would allow gay couples to adopt children, The Australian reported.

The Australian state includes the country's largest and most populous city, Sydney, home of the country's annual Gay & Lesbian Mardi Gras, one of the largest gay festivals in the world.

The bill, which would allow gay couples to adopt a child together, eked out a narrow victory for its sponsor, independent Sydney MP Clover Moore. The measure escaped a tie vote with only one vote to spare (46 to 44) after lawmakers debated its merits for two days.

“Unlike heterosexual couples, same-sex couples can't adopt a child together – one parent must adopt as an individual and the other has no legal standing as the co-parent, leaving the child in legal limbo,” Moore said in June, when she first introduced the measure.

An amendment that gives church-based adoption agencies the right to deny services to gay and lesbian couples without violating the law was being credited for saving the bill from defeat.

Supporters argue that the bill would benefit the 1,300 children in NSW already being cared for either by gay foster parents or a parent's gay partner.

If approved, New South Wales would join Western Australia and the Australian Capital Territory (ACT) in lifting the prohibition.