Australians voted overwhelmingly in favor of same-sex marriage, paving the way for legislation to legalize it. Almost 8 out of 10 eligible voters took part in the postal survey. (Reuters)

The Australian vote to legalize same-sex marriage by a substantial majority, overcoming a well-organized religious campaign against it, triggered elation in major cities Wednesday.

A nonbinding referendum conducted by mail found 61.6 percent of Australians in favor of allowing gay couples to wed. Even though the measure was expected to be approved, the size of the win and the unusually large participation of 12.7 million Australians out of the 16 million eligible voters added to its political legitimacy.

Though the vote isn’t binding, all major political party leaders have promised to implement the decision, which would make Australia one of about two dozen countries that allow gay couples to wed.

“The people of Australia have spoken, and I intend to make their wish the law of the land by Christmas,” Prime Minister Malcolm Turnbull said. “This is an overwhelming call for marriage equality.”

In a wealthy, urbanized country where 52 percent of the people regard themselves as Christian, according to a census last year, the vote marks a defeat for Australia’s two big churches, the Catholic Church and the Anglican Church, whose leaders were behind a well-organized campaign to defeat the referendum.

It also demonstrated deep rifts in Australian society. Opposition was concentrated in suburbs with high numbers of working-class immigrants on the suburban fringes, including locations popular with Islamic communities.

The largest levels of support were found in the wealthy urban hearts of Sydney, Melbourne, Brisbane, Adelaide and Perth.

At Sydney’s Prince Alfred Park, about 1,500 people gathered to celebrate and hear speeches by the organizers of the yes campaign after the results were announced on television.

“Love has had a landslide victory,” Alex Greenwich, a gay politician, said at the park while a popular 1970s Australian song, “Love Is In The Air,” played in the background.

One of the biggest majorities in favor of the referendum was in a beachside Sydney district held by former prime minister Tony Abbott, a conservative Catholic and onetime trainee priest who helped lead the “no” campaign.

Deposed two years ago by Turnbull after a series of blunders, Abbott has emerged as the prime minister’s biggest internal critic. He appeared to be using the same-sex marriage vote to energize conservative opposition to his more moderate leader inside their center-right Liberal Party.

Commentators said the fairly large majority would bolster Turnbull’s leadership. The prime minister, who said he voted “yes,” was initially criticized by some gay activists for resorting to a referendum rather than just asking Parliament to change the existing law, a move that could have split his party.

The public vote energized both sides, triggered a debate about religious freedoms in a country becoming more secular by the decade, and raised awareness that many gay Australians don’t feel fully accepted, even though same-sex relationships have had the same legal rights as conventional marriages for years.

Factions within the ruling Liberal-Nationals coalition are now arguing over the drafting of a new marriage law.

Conservatives wanted explicit provisions protecting businesses and organizations that refuse to service or participate in gay weddings on moral or religious grounds. Moderates, with Turnbull’s backing, seem likely to limit the protections to churches and marriage celebrants.

The debate reflects the global influence of the case of Colorado baker Jack Phillips, who was found to have violated state law by refusing to create a cake to celebrate a gay wedding. The baker said that doing so would violate his religious beliefs. The case is now before the U.S. Supreme Court. The Trump administration has sided with the baker.

Bakeries in Australia would be allowed to display signs saying they do not serve gay couples as a matter of conscience, under the conservatives’ proposal. Parents could withdraw their children from state-run schools that teach them about gay sex, too.

Critics said the measures are unnecessary, in part because of existing laws protecting religion expression and the fact that areas with large numbers of Christians voted for same-sex marriage, suggesting they don’t feel much threat to their religion practice.

“The churches are misguided because they are putting existing privileges at risk by arguing for an extension of religious privilege, which risks a backlash,” Peter Sherlock, the president of the Melbourne-based University of Divinity, said in an interview.

One of the unusual aspects of the debate was the important role business played. Risking a customer backlash, many large companies publicly endorsed same-sex marriage. The most prominent was the national airline Qantas Airways, whose chief executive, Irish-born Alan Joyce, is in a long-term relationship with a male ballroom dancer.