The Australian Labor Party has voted to support extending the legal definition of marriage to same-sex couples.
The move had been fiercely opposed by some in the party who argue it would lose Labor public support, but delegates at Labor's national conference in Sydney supported an amendment moved by Prime Minister Julia Gillard by 208 votes to 184.
They also voted to give the party's MPs a conscience vote on the issue of gay marriage.
The ABC reports up to 5000 people marched to Sydney's Darling Harbour to rally outside the conference.
The crowd chanted "conscience vote, no way, we want equal rights today".
Meanwhile, police had to keep supporters of same-sex marriage away from a smaller rally in central Sydney.
About 400 people who want marriage to remain as a union between a man and a woman gathered at the rally. A smaller group of same-sex marriage supporters tried to drown out the speeches with repetitive chants, but police kept them apart.