(NEW YORK) -- The man who might be the next mayor of New York City is someone most people have never heard of. Less than two months ago, New York City Public Advocate Bill de Blasio was struggling to get to 20 percent among Democratic primary voters. He even trailed the guy everyone did know: disgraced former congressman Anthony Weiner, whose lingering sexting scandal seemed to take most of the air out of the other candidates.
Votes are still being counted, but 97 percent are in and de Blasio has 40.2 percent of the vote to the 26 percent of his nearest competitor, former New York City Comptroller Bill Thompson. Weiner finished fifth.
It may take a week or more to find out whether de Blasio will be able to hold on to the 40 percent he needs to avoid a runoff, but his performance has surprised observers if only because it effectively upended the race for the most powerful mayoral job in the country.
So who is he anyway? Here's the trivia: He's a Massachusetts-bred Brooklynite who has boldly declared his love for the Boston Red Sox over the Yankees. He is married to an African-American woman, Chirlane McCray, who tells people she was a lesbian in the 1970s. De Blasio served as Hillary Clinton's 2000 Senate campaign manager and on the New York City Council. And he has a celebrity entourage that includes endorsements from the likes of Sex and the City actress Cynthia Nixon, civil rights activist and singer Harry Belafonte, and actress Susan Sarandon. But perhaps most importantly, he has something of a knack for being the dark horse.
"I did his campaign four years ago for public advocate and he was behind Mark Green, then he shot up," said George Arzt, a public relations consultant who served as former New York Mayor Ed Koch's press secretary. "He didn't have the name recognition of others and then when the others fell by the wayside he was left standing."
So in a campaign that featured Weiner's attempt to be the comeback kid, the title was taken instead by de Blasio. Like Weiner, de Blasio campaigned as an unabashed liberal. And as Weiner voters abandoned him, de Blasio was well positioned to bring them into his campaign's fold. He also highlighted his opposition to Mayor Michael Bloomberg, an independent, which delighted Democratic voters after 12 years under his governance. At his celebratory party last night, de Blasio called his vision an "unapologetically progressive alternative to the Bloomberg era."
Exit polls from Tuesday night's primary found that Democratic voters wanted the next mayor to move away from Bloomberg's policies. And most say that the controversial "stop-and-frisk" policy, which Bloomberg championed as the key to reducing the city's crime, resulted in the harassment of innocent people.
De Blasio made his opposition to "stop and frisk" a central part of his campaign, and when a federal court ruled it violated constitutional rights in August he led the charge to denounce the policy and Bloomberg.
"It vindicated his position," said Mitchell Moss, a political scientist at New York University, and a former adviser to Bloomberg in 2001.
He's promised to tax the rich to fund education, and has denounced Bloomberg's business-driven governing philosophy.
For Bloomberg, de Blasio's rise has been a hard pill to swallow.
In what may have been a slip of the tongue in an interview with New York Magazine, Bloomberg called de Blasio's campaign "class-warfare and racist," only to clarify that he believed de Blasio used his bi-racial family in ads to appeal to black voters.
"I think Bloomberg is very frustrated. He took a real beating during the campaign, especially from de Blasio," Arzt said. "And Bloomberg looks down his nose at de Blasio for not having a business background."
If de Blasio's narrow edge of 40 percent holds up, making him the Democratic nominee, he will try to become the first Democrat elected to the nation's largest city since 1989.
He would face the Republican candidate, former Metropolitan Transit Authority chairman and former deputy mayor to Rudy Giuliani, Joe Lhota, in November.
To close the deal with the general electorate -- composed of more than 800,000 people who are not affiliated with either the Democratic or Republican Party -- he may have to moderate, Moss said.
"He's a professional politician and he will recognize that he will need to move to the middle in order to win a general election," Moss said. "Running the city is going to require you to be constantly attentive to the different interests and different groups of people."
Copyright 2013 ABC News Radio