It has been more than 35 years since George M. Sullivan, the former mayor of Anchorage, vetoed a bill passed by the city assembly that would have extended basic civil rights protections to gays. It has been three years since his son, Dan, the current mayor, vetoed a similar bill.

On Tuesday, supporters of gay rights in the city, Alaska’s largest, took the issue out of the mayor’s hands — but the end result was the same. In a citywide ballot measure, voters overwhelmingly rejected language, known as Proposition 5, that would have added protections for people regardless of “sexual orientation or transgender identity” to the city’s civil rights laws.

A surprisingly strong turnout caused many polling sites to run out of ballots late Tuesday, and as many as 8,000 votes, possibly more, had not been counted on Wednesday, said Barbara Gruenstein, the clerk for the Municipality of Anchorage. But Proposition 5 trailed by nearly 9,000 votes, defying polls that had suggested it would succeed.

“Amazing what happens when the curtain closes behind you in a voting booth,” Jim Minnery, the chairman of Protect Your Rights Campaign — Vote No on Prop. 5, said Wednesday morning in an e-mail.