Australia’s Prime Minister Julia Gillard, who is strongly opposed to equal marriage, has been ousted as leader of the country’s Labor Party by former PM Kevin Rudd.

Her predecessor is now more popular with voters than Ms Gillard, and many believe Labor will perform better in September’s federal election under him, although most pollsters still think the party will be defeated by the Liberals.

On Wednesday Mr Rudd won 57 votes in a leadership ballot called by Ms Gillard, who received 45 votes.

Ms Gillard had said ahead of the vote she would step down from politics if she lost the ballot.

She must write to Governor General Quentin Bryce stating that she is resigning as prime minister before Mr Rudd can be sworn in as the new PM.

Mr Rudd announced his support for equal marriage in May, having previously been against it.

The 55-year-old said he had come to “believe the secular Australian state should be able to recognise same-sex marriage”.

Julia Gillard remains opposed to equal marriage.

On becoming prime minister in 2010 she said: “We believe the Marriage Act is appropriate in its current form, that is recognising that marriage is between a man and a woman, but we have as a government taken steps to equalise treatment for gay couples.”

She ruled out introducing equal marriage in May following neighbouring New Zealand’s decision to introduce the measure.

In April, Australia’s Liberal Party leader Tony Abbott said he opposed proposals to hold a public vote on equal marriage during September’s election.

Efforts to legalise the measure failed in the Australian Parliament last year.