Not long ago, as Mayor Bill de Blasio continued to withhold his endorsement in the presidential race, one of his most trusted political advisers presented him with a clear message: Back Hillary Rodham Clinton and be done with it.

The advice, from Nicholas Baldick, a Democratic consultant and one of the chief architects of Mr. de Blasio’s mayoral victory, echoed concerns that had coursed through the mayor’s inner circle for weeks. Mrs. Clinton had expressed support for many of the liberal economic policies that Mr. de Blasio wanted. She had the blessing of virtually every other Democrat in New York politics.

What, close allies wondered, was Mr. de Blasio waiting for?

Now, a tale that began with a Shakespearean touch — the mayor, on national television, denying Mrs. Clinton, his former boss, an endorsement on the day she announced her candidacy — appears to be ending with a murmur: Mr. de Blasio is in discussions with Mrs. Clinton’s camp about an endorsement, according to two people briefed on his plans, who said the mayor was expected to offer a blessing soon.

Such a move was widely viewed as inevitable, in part because Mr. de Blasio’s will-he-or-won’t-he dance had appeared increasingly untenable. Instead of focusing attention on income inequality, Mr. de Blasio was drawing public mockery. Some Democratic officials complained that the mayor was overly focused on being a liberal kingmaker, particularly after his team announced plans for a forum for presidential candidates in Iowa this fall.