Bill de Blasio appears poised to easily beat back a primary challenge next week and win re-election in November as New York City’s mayor. But if he is not careful, a second term could be plagued by significant political problems: The ghosts of the mayoral quagmire from Robert Wagner’s third term and the strife of John Lindsay’s second term hover as omens.

I am not suggesting that the Republican challenge expected by Assemb. Nicole Malliotakis of Staten Island is a waste of time. To the contrary, the city benefits from a sharp policy debate. Still, a look at the city’s electorate highlights an uphill battle for Malliotakis. Here’s a percentage breakdown of total voters:

  • Black voters, 26 to 28 percent.
  • Hispanic voters, 18 to 20 percent.
  • “New class” voters (mostly white professionals in Manhattan and Brooklyn’s Brownstone Belt), 17 to 20 percent.
  • Outerborough Jewish voters, 18 to 19 percent.
  • White Catholic voters, 8 to 11 percent.
  • Asian voters, 6 to 8 percent.

De Blasio is likely to win in November, precisely because no single opponent — in the Sept. 12 primary or the Nov. 8 election — has the appeal to pull Hispanic and Asian voters from supporting him. And, the mayor still has residual strength with black and progressive white voters, who form a significant chunk of the “new class” voters.

Still, the lessons of Wagner’s third term and Lindsay’s second term loom large. Reform voters elected Wagner in his “beat the bosses” comeback re-election in 1961. Lindsay won a three-way race in 1969 against two conservative candidates by cobbling together a coalition of liberal, moderate Jewish and emerging minority voters.

The expectations of progressive supporters could not be realized by Wagner or Lindsay. That frustration led to political morasses that stalled both men.

Lindsay, in particular, got caught in a vise between unrealistic expectations among liberals and the unyielding backlash of conservatives on race and culture. History records that Lindsay’s second term was marked by significant management accomplishments, but it was marred by the politics of his poor decision to run for president in 1972, and a racial controversy over scatter-site housing in Forest Hills, which ripped away crucial Jewish support.

If de Blasio, for instance, were to lose significant Hispanic and/or Asian support, say over the siting of a local jail if Rikers Island is closed or over a homeless shelter in a politically active residential community, the mayor’s governing strength could be weakened, just as Lindsay’s was in his second term. De Blasio could wind up being devoured by the progressive tiger he awakened in 2013 if he doesn’t meet expectations — the same dynamic that drained Wagner’s third term.

Developing a reputation for consistently producing results is the best medicine for combating that mix of complacency and hubris that tends to grind down Gotham’s mayors after re-election.

Bruce N. Gyory is a political and strategic consultant and an adjunct professor of political science at the state University at Albany.