Anchorage voters soundly rejected Ballot Measure 1 in Tuesday's election, in effect repealing the Sullivan administration's rewrite of city labor law and handing a triumph to labor unions that have spent nearly two years bitterly fighting the measure.

With all precincts reporting early Wednesday morning, the vote was 54 percent to 46 percent in favor of repealing Anchorage Ordinance 37, or AO-37.

"We are ecstatic the community supports us and the work we do for them," said Gerard Asselin, president of the Anchorage Coalition of Unions and a sergeant for the Anchorage Police Department.

The labor law would have sharply curtailed union power by revamping the collective bargaining process for city employees.

The outcome marks a policy setback for Mayor Dan Sullivan, who made what he called the "Responsible Labor Act" a signature piece of legislation for his administration and touted its protections for taxpayers. Sullivan was also narrowly losing in his bid for lieutenant governor late Tuesday night, but the race was too close to call.

Late Tuesday night, Sullivan said he wasn't disappointed in the result on AO-37.

"I've always said AO-37 was designed for future administrations, because I knew I could negotiate tough and fair agreements with our local employees," Sullivan said. "Fair to employees, but also to the taxpayers."

He said the outcome wasn't a surprise, given the massive amount of union spending in opposition to the law. The latest campaign finance reports available show that since early September, unions have spent at least $723,000 fighting to repeal AO-37, roughly 10 times as much as their opponents.

The repeal of AO-37 will formally take effect when the election results are certified. The law has been suspended since August 2013. City charter states the Assembly must wait at least two years before re-enacting a "measure" rejected by referendum -- though it's not yet clear whether that refers to AO-37 in its entirety, or to the individual provisions.

Among other changes, AO-37 would have limited pay raises for city employees, eliminated binding arbitration and, for non-public-safety employees, the right to strike, set up a system for outsourcing some union work and given management control over staffing, scheduling and equipment.

The measure has faced heavy resistance from unions since it was introduced in February 2013 and in recent weeks has been the focus of a vigorous, well-funded campaign.

Around 8 p.m. Tuesday, members of local labor unions were gathered in the "No on 1" campaign headquarters, a warehouse on First Avenue in Anchorage. As people munched on tacos and candy, the atmosphere was nervous but also upbeat.

The building is also the headquarters for this year's labor campaign, working to increase the minimum wage and elect candidates, and Working Alaska, the state branch of the labor organization Working America. Standing on the lower floor with a projection screen on the wall, Joelle Hall, director of operations for the AFL-CIO, estimated that labor unions had knocked on at least 90,000 doors in Anchorage in the last two weeks.

A number of voters surveyed at Anchorage polling places Tuesday said they felt the changes in AO-37 went too far.

"They need to have a voice," said Stephanie Mchen, 44, an employee at Alaska Regional Hospital. She added, referring to police officers and firefighters: "They work hard and do a dangerous job."

In about eight weeks of campaigning, unions focused in particular on the law's staffing and equipment provisions, making dire predictions about public safety. Black and yellow yard signs with the slogan "Keep Anchorage Safe" appeared across the city in September, and household mailers sent in the last two weeks warned of staffing impacts and long waits on 9-1-1 calls.

As well as public safety, union representatives focused on recruitment and retention in an aggressive phone banking and door-knocking effort, as well as radio, digital and print advertising. The "No on 1 -- Repeal 37" campaign was composed of a coalition of unions and its committee chaired by two veteran law enforcement officials, Walt Monegan and Craig Goodrich.

Campaigning for Ballot Measure 1 was lopsided, both in spending and visibility. After the launch of the "No on 1" campaign in early September, it took more than three weeks for an opposing campaign to materialize. When the "Vote Yes for Anchorage -- Vote Yes on 1" campaign did surface, it was spearheaded by two former Anchorage Assembly members, Chris Birch and Cheryl Frasca, who were allied with Sullivan on the law.

Heavily outspent, the "Yes on 1" campaign relied on social media, digital advertising and tactics like copying the design of its opponent's yard signs to communicate messages about protecting taxpayers and curbing municipal labor costs.

One voter at Anchorage Bible Fellowship on Elmore Road said she decided to vote to keep AO-37 after reading a newspaper booklet that listed the salaries of Anchorage public employees.

Tuesday's election marks the culmination of a 22-month political roller coaster for the measure. It has been embroiled in near-constant political drama since its introduction in February 2013. Twice repealed by the Anchorage Assembly, the ordinance went through two court cases on its way to becoming a referendum and played a pivotal role in shaking up the local political scene in the April municipal election.

In September, the Assembly failed to override Sullivan's veto on a compromise version of the law, setting the stage for it to appear on the state general election ballot as a referendum.

Because the referendum was strictly a municipal issue, the state put it on the second page of the ballot as the last item. The question of whether to keep or repeal the law appeared as a single line, without any explanatory language.

Those factors appeared to have confused some voters Tuesday. The city clerk's office received calls throughout the day, said Amanda Moser, deputy city clerk, prompting extra outreach on social media feeds. Moser said several callers even left their polling place and then called to ask if the referendum had been on the ballot.

Mchen said she almost asked a precinct worker where the referendum was on the ballot because she didn't see it at first.

Even some union members were confused. Outside of the Anchorage Bible Fellowship, Clarence Olhausen, a carpenter with Carpenters Local 1281, said that when he got to the voting booth, he wasn't exactly sure whether he needed to choose "yes" or "no" to vote to repeal the measure. He ended up guessing correctly, casting a "no" vote.