Proponents of gay rights spent the day celebrating. They gathered in cities around the country to watch news broadcasts of the survey results. The largest crowd, at Prince Alfred Park in Sydney, broke into cheers, with hugs, dancing and tears, as soon as the news was announced.

“This is our proudest moment as gay and lesbian Australians,” said Chris Lewis, 60, an artist from Sydney, who waved a large rainbow flag he bought in San Francisco about 30 years ago. “Finally I can be proud of my country.”

But many Australians said it was also late in coming.

Annika Lowry, 42, who brought her 4-year-old daughter to the celebration, said the vote revealed a widening gap between Australia’s political class and voters who have been demanding same-sex marriage legislation for years.

“It was not just about us,” she said. “It’s for our kids, so that they know equality is important.”

Alex Greenwich, a state lawmaker from New South Wales and the co-chairman of Australian Marriage Equality, an advocacy group, said the vote “shows that Australians have truly come together in support of their gay and lesbian mates and have said that everybody should be able to have the freedom to marry.”

In calling for the national survey, Mr. Turnbull sought public backing for a shift in social policy that was opposed by many members of his center-right Liberal Party.