New York Mayor Michael Bloomberg’s name wasn’t on any ballot on Tuesday, but voters in two states delivered sharp rebukes of his policies nonetheless.

Democrats in the Big Apple likely picked Public Advocate Bill de Blasio, who had positioned himself as the most liberal candidate in a crowded Democratic field, as their nominee to take over when Bloomberg leaves office after completing his third term. And Colorado voters booted two Democratic state senators who had significant financial support from Bloomberg in a recall election spurred by gun control legislation that passed earlier this year.

The very different campaigns shared one thing in common: Bloomberg, cast as the villain, playing a starring role.

De Blasio led the Democratic mayoral primary with 40.2 percent of the vote with more than 98 percent of precincts reporting, staying barely above the threshold that would allow him to avoid an Oct. 1 runoff. His candidacy rested on  contrasting himself with some of Bloomberg’s most unpopular policies. He has promised to raise taxes on the wealthy to pay for universal pre-kindergarten, and to end a stop-and-frisk program that Bloomberg’s police department instituted, two positions that set him apart from the rest of the Democratic field.

The candidate’s message was explicitly anti-Bloomberg: “He’s the only Democrat with the guts to really break from the Bloomberg years,” de Blasio’s son, Dante, says in the campaign’s first television advertisement.

De Blasio beat out city council Speaker Christine Quinn, former city Comptroller Bill Thompson and ex-Rep. Anthony Weiner, three candidates who began the race with much higher name identification. Quinn came under withering fire for her close alliance with Bloomberg, Thompson never surged and Weiner’s comeback bid flamed out after yet another sexting scandal.

De Blasio, on the other hand, picked up momentum in the final weeks as the race became a referendum on Bloomberg’s tenure. It has been 20 years since a Democrat presided in New York’s city hall, and party activists saw de Blasio as a candidate who stood for their principles.

“Most people have come to believe that [this election is] really about a rejection of Bloomberg, at least the last four years of Bloomberg,” Liz Benjamin, a New York political analyst and host of YNN’s Capital Tonight, said on PostTV’s In Play. “He changed the city for the better, many people would agree, but he also created under his watch a wider rift between the haves and the have-nots.”

In Colorado, voters recalled  Democratic state Sens. John Morse and Angela Giron, strong backers of gun control legislation that passed earlier this year over the vocal objections of gun rights activists. The recall against Giron passed by a 12 percent margin, while voters ousted Morse by a far narrower 2 percent margin; the results mean two little-known Republicans, former Colorado Springs city councilman Bernie Herpin and conservative activist George Rivera, will fill the remainder of Morse’s and Giron’s Senate terms.

The legislation that spurred the recall efforts had the support of Mayors Against Illegal Guns, a coalition of city officials from across the nation that Bloomberg leads. After passage of the legislation, conservative activists collected more than 10,000 signatures to force both Morse, of Colorado Springs, and Giron, of Pueblo, back on the ballot.

Bloomberg inserted himself into the race last month by donating $350,000 to the cause. Other liberal groups spent millions more on television and mail ad campaigns aimed at saving the Democratic senators, while the National Rifle Association spent about $361,000 against the Democrats.

But Bloomberg’s money wasn’t necessarily a positive for Morse and Giron, both of whom tried to change the subject to anything other than the gun legislation.

“It’s been a double-edged sword for the candidates,” Rick Ridder, a Democratic strategist in Denver, said of Bloomberg’s involvement. “On the one hand, it provided ready support and resources. On the other hand, it may have kept the [focus] on guns longer than they might have wanted.”

“There has been a backlash with the disclosure of Bloomberg money,” said Laura Carno, a conservative activist who led the recall campaign against Morse. “People wonder why his is playing in Colorado. I had one person ask if we were going to have to limit soda sizes soon.”

The elections in New York and Colorado are likely to have an impact on Bloomberg’s legacy, and on his future plans.

In New York, assuming his runoff-avoiding 40 percent margin holds, de Blasio still has to beat former Metropolitan Transportation Authority chairman Joseph Lhota (R), who on Tuesday won the GOP primary by a wide margin. But if he becomes the city’s first Democratic mayor in 20 years, de Blasio will take New York down a new and different path.

The ramifications in Colorado may be measured more by what doesn’t happen. Democrats planning to introduce gun control legislation in their states are likely to be far more wary about pushing those bills aggressively if they know the NRA and gun rights activists are able to force them into a recall election.

“The NRA has wielded a lot of influence for a long time in legislatures,” said Michael Sargeant, the executive director of the Democratic Legislative Campaign Committee.