SUNNYVALE — A controversial gun control measure that would propel this politically moderate — and comparatively low-crime — South Bay city to the forefront of what had been a stalled national movement to restrict firearms, had an insurmountable lead late Tuesday.

Measure C — which requires gun owners to report a loss or theft of their weapon to police within 48 hours, to keep firearms locked up when not in the owner’s direct possession and prohibits ammunition magazines that hold more than 10 rounds — received 66 percent support with all precincts counted, with 34 percent voting no. It was a resounding victory for Mayor Tony Spitaleri, who decided to push for the new law after last year’s massacre in Newtown, Conn. The returns are unofficial with provisional and last-minute mail-in votes still to be counted.

The mayor’s preferred slate of candidates for three open City Council seats also was leading late Tuesday. Gustav Larsson led Andy Frazer 53 percent to 47 percent for Seat 1; Glenn Hendricks with 58 percent took a commanding lead over Steve Hoffman with 36 percent and Gustavo Magana, 6 percent, for Seat 2; and Jim Griffith led Tap Merrick, 66 percent to 34 percent.

The gun measure attracted statewide, and even some national, attention because of the involvement of New York City Mayor Michael Bloomberg — who donated $3,000 in support of Measure C — on one side, and the National Rifle Association — which was threatening to sue the pants off Sunnyvale if the measure passed — on the other.

Before a room full of supporters at a Sunnyvale hotel Tuesday night, Spitaleri declared, “What we did here, quite bluntly, is we defeated the NRA tonight.”

Spitaleri had prodded the City Council to put the issue before voters after a brief petition drive for a ballot measure garnered more than 1,100 signatures.

But in Sunnyvale, the real passion play was about the composition of the next City Council, a body so riven with personality conflicts and sniping that many citizens flock to the council chambers to binge watch the show in person instead of on cable.

After Councilman Pat Meyering was censured by his colleagues earlier this year, his opponents — not least among them the mayor — posed the idea that Tuesday’s election would be what Spitaleri called “a referendum on civility.”

Candidates seen as sympathetic to Meyering’s often combative approach to commercial development — Frazer, Merrick and Hoffman — were portrayed by the mayor as disruptive.

In a town with such polarized politics, a former councilman worried that some voters would miss the point of Tuesday’s balloting. “It’s a very important election,” said Tim Risch, who, with his wife, Yolanda, runs SpecialInterestWatch.org, a website that monitors local issues. “And I should emphasize that in this election, the issue of civility is a red herring, it’s a distraction from the real issues, which are development, employee pensions and fiscal responsibility.”

Risch’s website had taken note of an identical pair of “independent expenditures” — an eye-popping $70,580 each — that benefited the campaigns of Larsson and Hendricks.

The money was spent by the National Association of Realtors, whose spokesperson in Washington, D.C., said the million-member trade association was acting at the behest of the Silicon Valley Association of Realtors. That organization’s spokesperson, Rose Meily, indicated Sunnyvale was a real estate plum ripe for picking.

“I know that Sunnyvale is a real important election to us,” Meily said, “and I know they wanted to make sure the voters knew about the best qualified candidates.”

With major developments such as the new 600,000-square-foot LinkedIn headquarters going up in Sunnyvale, an infusion of national PAC money unlike any ever seen before had some in the city of 146,000 worried.

“Sunnyvale is clearly on the cusp of a major development boom,” Risch said. “And those are incredibly large numbers for a local race like this. It’s just astounding.”