New York Republican mayoral hopeful Joe Lhota, left, and New York City Democratic mayoral hopeful Bill de Blasio. (AP/AP)

Bill de Blasio clinched the Democratic mayoral nomination Monday, setting the stage for a potentially divisive campaign against a Republican who served under tough-on-crime former mayor Rudolph W. Giuliani.

Bill Thompson, a former city comptroller who placed a distant second in last Tuesday’s Democratic primary, conceded the race to de Blasio before all of the votes had been counted. There had been intense pressure from fellow Democrats to avert what could have been a bruising runoff.

Thompson’s concession leaves de Blasio, the city’s Public Advocate, facing Republican Joe Lhota, a former deputy mayor under Giuliani during a time when the city’s crime rate plummeted and onetime head of the city’s mass-transit agency.

On Nov. 5, New Yorkers will decide which candidate will succeed Mayor Michael R. Bloomberg (I), who is stepping down after 12 years in office because of term limits.

“There is nothing more beautiful than Democratic unity, and thank you for it,” de Blasio said on the steps of City Hall, accompanied by Thompson, Gov. Andrew M. Cuomo and an array of other leading Democrats.

De Blasio needed 40 percent of the primary vote to avoid a runoff and won roughly that number, compared to about 26 percent for Thompson. Earlier, Thompson had vowed to stay in the race until the count of ballots of absentee voters and military personnel was finished this week.

De Blasio, who worked in the Clinton White House and later was a New York council member, has built his campaign around addressing income inequality and called for higher taxes on the rich to expand pre-kindergarten programs. He has been a fierce critic of the police tactic of “stop and frisk,” which some say targets young black and Latino men.

“We have to stop having the tale of two cities,” said Michael Mulgrew, the president of the city’s teachers union, echoing a frequent refrain of de Blasio’s campaign.

The union, which endorsed Thompson in the primary, said Monday that it is now firmly behind de Blasio.

Lhota, who describes himself as a fiscal conservative but a liberal on such social issues as same-sex marriage, has said he wants to highlight stark differences with his rival to win over moderates in the heavily Democratic city.

He has been largely supportive of Bloomberg’s anti-crime tactics, including “stop and frisk.” He, too, has said he would attempt to expand access to pre-kindergarten programs — but not through higher taxes — and to affordable housing.

Lhota has said de Blasio’s description of a “tale of two cities” — one rich, one poor — is meant to divide New Yorkers along class lines.

“He’s doing it to divide and conquer,” Lhota told Fox Business News last week.

— Reuters