NEW YORK – Bill de Blasio has gone from afterthought to front-runner with stunning speed.

The most liberal candidate in the New York City mayoral race, whose City Hall bid was floundering mere weeks ago, now enjoys a shocking perch atop the polls in the latest turn of the most unpredictable citywide campaign in decades.

And with the Democratic primary now less than a month away, de Blasio may have hit his stride at just the right time.

De Blasio, the city’s public advocate, has been given a second look by an electorate that appears intrigued by his progressive policies and charmed by his multiracial family. His first TV ad, narrated by his soft-spoken 15-year-old son, came out just before his rise in the polls.

De Blasio of Brooklyn has also clearly benefited by the implosion of Anthony Weiner’s candidacy, winning over legions of supporters turned off by the former Brooklyn and Queens congressman’s latest sexting scandal.

Independent Mayor Michael Bloomberg’s impending departure after 12 years in office has created a wide-open race; the Democratic field alone has had three different leaders in as many weeks.

A Quinnipiac University poll last week showed that de Blasio’s support had doubled in less than a month, pushing him from fourth to slightly ahead of the pack. A second poll released last week showed him in a dead heat with City Council Speaker Christine Quinn, with ex-comptroller Bill Thompson slightly behind.

De Blasio, 52, believes it was simply a matter of time before his message resonated with left-leaning voters in New York City, where Democrats outnumber Republicans 6 to 1.

“It’s happening now because people are finally starting to focus on the race,” de Blasio told The Associated Press. “After 12 years of Mayor Bloomberg, people want a real change.”

De Blasio, though largely unfamiliar on the national stage, has been a fixture for two decades in New York politics.

He was born in Massachusetts — and remains a Boston Red Sox fan — but as an adult became entrenched in the New York’s liberal circles. De Blasio who stands 6-feet-5, advised former New York Mayor David Dinkins, worked in Bill Clinton’s White House, chaired Hillary Clinton’s 2000 Senate campaign and served on the City Council before becoming public advocate four years ago.

It is rare to find a candidate who appears almost gleeful when proposing raising taxes, but de Blasio has happily made as the centerpiece of his campaign a proposal to raise taxes on the wealthy to pay for universal pre-kindergarten.

He repeatedly brandishes the phrase “A tale of two cities” to rip the economic inequality between the rich and poor in the nation’s largest city.

And he has consistently attacked the New York Police Department’s stop-and-frisk program.

De Blasio also has put his interracial family at the heart of his campaign. His wife is an African-American who once identified as a lesbian, and their two teenage children are frequently on the campaign trail.

Their son, Dante, lovingly talks in the ad about his father’s life and policies, including his opposition to stop-and-frisk. His earnest delivery and impressive Afro have made him a Twitter star, leading to the light-hearted hashtag #fromentum.