As a master strategist for the New York Democratic Party, Mr. Wolfson worked with a handful of other elite party operatives to lay out a grand plan to defeat Mr. Bloomberg in the 2005 mayoral race, writing in an internal memo, “Michael Bloomberg is an out-of-touch billionaire who can’t relate to the problems of ordinary New Yorkers.”

When the mayor tried to impose nonpartisan elections in the city, Mr. Wolfson called it a “cynical power grab.” When he spent tens of millions of dollars of his own money to bankroll his re-election, Mr. Wolfson said such spending “distorts the terms of the debate.” He impugned Mr. Bloomberg’s attempt to build a West Side stadium (an “out-of whack-priority”) and even criticized his beloved “Gates,” the saffron cloth panels arrayed through Central Park by the artist Christo (“shmattes on sticks”).

And when some prominent Democrats defected to the Bloomberg camp that year, Mr. Wolfson cried foul, declaring himself personally dismayed by their disloyalty.

This year, Mr. Bloomberg is again spending tens of millions of dollars to run for re-election on the Republican ballot line against a Democratic opponent. But this time, Mr. Wolfson is a senior architect of the effort.

Mr. Wolfson’s conversion has become a source of fascination and dismay among New York Democrats, who are now on the other end of the cutting brand of politics he perfected as a chief strategist for Hillary Rodham Clinton. In the city, he is credited in political circles with pressuring Representative Anthony D. Weiner, a Democrat, to quit the mayor’s race. The switch has been cited as an example of how the billionaire mayor, who is prepared to spend as much as $100 million of his own money to win a third term, can buy the silence of even his most ardent critics — an assertion summarily dismissed by Mr. Wolfson, whose consulting firm is earning $40,000 a month from the campaign.

“The risk for someone like Howard is that he is surrendering his credibility,” said Joel Benenson, a senior political adviser to President Obama who was Mr. Weiner’s campaign pollster. “He made countless statements to the press during the presidential primaries that were wrong, and now he’s saying things that completely contradict what he said four years ago.”

For Mr. Wolfson, who in a 2005 profile boasted of never having dated a Republican, the transition has brought its share of personal and professional difficulties. Most nights this spring, he could be found in a room alone at the W hotel in Union Square — or any other hotel, he said, that he could find on Travelocity for under $300 a night — while his wife, Terri McCullough, chief of staff to the House speaker, Nancy Pelosi, and two children, one an infant, remained in Washington. (Ms. McCullough is on maternity leave, and the family is spending the summer together in an Upper West Side sublet).

And after years in the upper echelons of Mrs. Clinton’s campaign, he remains something of an outsider in the efficient corporate culture of the Bloomberg camp, where he was initially viewed with suspicion by some veterans.

Mr. Wolfson said in an interview at the Bloomberg campaign complex in Midtown that he was as surprised as anyone to be where he was, but he described himself as one of many Democrats who have come to admire the mayor — and said such political conversions are the best testament to the cross-party allure of Mr. Bloomberg’s nonideological way of governing.

Still, there is an alternate view: that Mr. Wolfson, reeling from Mrs. Clinton’s demoralizing loss, and an object of scorn among some Obama loyalists for the attacks he waged long after it became clear that she had no chance of winning, saw in Mr. Bloomberg an easy, high-profile victory.

“I am not interested in losing,” he said.

Mrs. Clinton’s drawn-out defeat in last year’s presidential primaries was a defining moment in the long journey that took Mr. Wolfson from the relative obscurity of local Democratic politics to the pinnacle of national campaigns and, now, to his new and unexpected perch.

A native of Yonkers, Mr. Wolfson, 42, received a master’s degree in history from Duke University, then covered local politics at a weekly newspaper in Virginia. He worked for Representative Nita M. Lowey of Westchester, then for Charles E. Schumer’s campaign for the Senate in 1998, before joining Mrs. Clinton’s 2000 Senate bid.

She was initially wary of Mr. Wolfson but in time she grew fond of him, a person close to her said, partly because of his idiosyncrasies: He can be painfully shy; his fear of flying is so deep that he drives to even the most far-flung campaign stops; and his food allergies, including those to fish and nuts, have forced him to hold conference calls from the hospital.

Several years after Mrs. Clinton’s victory, Mr. Wolfson opened a New York office for a consulting firm based in Washington, the Glover Park Group, and quickly built a large client base that included Rupert Murdoch, longtime bête noir of Democrats, who owns The New York Post and Fox News Channel.

During that time, Mr. Wolfson established himself as a fierce adversary of the mayor. His firm helped orchestrate the successful campaign to defeat Mr. Bloomberg’s proposed West Side stadium, doing so on behalf of Cablevision, the company that owns Madison Square Garden, which might have been hurt by the competition. He was also hired by the New York State Democratic Party to derail a proposal by Mr. Bloomberg, then a Republican, to limit the role of political parties in city elections.

But by the fall of 2005, his attacks on the mayor had abated. Mrs. Clinton had asked him to stand down because she wanted Mr. Bloomberg to remain neutral in her own re-election race the next year and figured that Mr. Wolfson’s criticism would only antagonize him, a senior Clinton campaign aide said.

Once Mrs. Clinton won a second term to the Senate, her political operation quickly shifted gears and began her presidential bid, with Mr. Wolfson as director of communications. Working from Virginia, he ran a war room that was a 24/7, take-no-prisoners operation that relied on the aggressive peddling of information embarrassing to opponents and flattering to Mrs. Clinton.

Mr. Wolfson originally proposed emphasizing Mrs. Clinton’s biography rather than attacking rivals, but he was overruled and eventually became the face of her bare-knuckled fight with Barack Obama. “A decision was made about the strategy and he executed it,” said Patti Solis Doyle, Mrs. Clinton’s former campaign manager. “And he executed it well.”

So well that, as his barrage continued unabated despite the inevitability of defeat, the television host Chris Matthews told him on MSNBC one night, “You’re like one of these Japanese soldiers that’s still fighting in 1953.”

After the campaign, when Mr. Wolfson signed up as an analyst with Fox News, Mr. Matthews called it “Howard’s End,” identifying it as a sign of his isolation from the national Democratic Party.

Photo

BACKGROUND Howard Wolfson, behind Hillary Rodham Clinton in 2000, and the mayor this year.Credit
Top, James Estrin/The New York Times; Bottom, Chester Higgins Jr/The New York Times

But in New York, many Democrats, including his friends, figured he would help the party retake City Hall. In 2005, he helped William C. Thompson Jr. get re-elected as city comptroller; he was widely expected to join Mr. Thompson again, this time as an adviser to his mayoral campaign.

But Mr. Wolfson demurred when Mr. Thompson’s campaign manager, Eduardo Castell, called last summer to see if he would sign on, saying he needed a break from the grind of politics.

Mr. Castell said in an interview that he accepted the explanation given by Mr. Wolfson, who had become a despondent, gloomy figure around the campaign offices during the final stages of the presidential primaries.

An error has occurred. Please try again later.

You are already subscribed to this email.

It was, however, a much angrier conversation, Mr. Castell said, when Mr. Wolfson called a few months later to report that he would indeed join the race — for Mr. Bloomberg. “I certainly had a reaction, but I’ll leave it at that,” Mr. Castell said, adding, “I always knew him to be a true believer in what the Democratic Party stood for. Obviously, in 2009, that changed.”

Even his closest friends were taken aback. “I’m literally shocked,” said Jen Bluestein, who worked for Mr. Bloomberg’s 2005 opponent, Fernando Ferrer. But, she said, she came to accept it, given his loyalty to the Ferrer campaign four years ago.

Mr. Wolfson said he was initially reluctant to join the Bloomberg camp. Though many Democrats say he was tempted in part by the mayor’s penchant for showering top campaign advisers with large salaries and bonuses, Mr. Wolfson denied that he took the job for the money, saying he had other lucrative opportunities. The mayor’s change in party registration to independent from Republican, Mr. Wolfson said, helped (though Mr. Bloomberg is planning to run again as the Republican nominee this year).

Over a series of meetings, Deputy Mayor Kevin Sheekey, Mr. Bloomberg’s longtime political adviser, coaxed Mr. Wolfson to sign on by posing a single question: Did he believe anybody else in the running would be a better mayor? Mr. Wolfson said his response was no.

“There has been an evolution among rank-and-file Democrats in recognizing him as a great mayor,” Mr. Wolfson said.

For his part, Mr. Sheekey, who once accused Mr. Wolfson’s firm of having “corrupted” the political process with its relentless attacks on the mayor, said in an interview that he would rather have Mr. Wolfson working for him than against him.

“I have both respected and feared Howard from probably the first day I met him,” he said, adding: “Howard coming to work for Mike Bloomberg is no different than Hillary Clinton going to work for Barack Obama: Think of all the nasty things that Hillary Clinton said about Barack Obama.”

Mr. Wolfson claimed his first Democratic scalp in May, as Mr. Weiner — once a close ally in the Clinton campaigns — dropped out of the mayoral race amid a Wolfson-led behind-the-scenes campaign to force him to do just that.

Working with a local press corps he had cultivated for years, Mr. Wolfson and his team dug up and then pushed a steady stream of politically damaging tidbits about Mr. Weiner, giving the congressman an early taste of what he might face come the fall.

In one instance, Mr. Wolfson’s team discovered that Mr. Weiner had introduced a bill making it easier for foreign-born fashion models to work in the United States. In New York’s tabloid news culture — one Mr. Wolfson navigates well — the discovery produced unflattering news stories packaged with photographs of the congressman and sultry exotic models.

No matter that Mr. Weiner was someone Mr. Wolfson dispatched frequently as a surrogate against President Obama during last year’s primaries, or that Mr. Weiner’s fiancée, Huma Abedin, is a confidante of Mrs. Clinton’s whom Mr. Wolfson once considered a friend.

But Mr. Wolfson said that it was a fair fight and that he relished what he had accomplished. His team commemorated Mr. Weiner’s departure from the race by tacking on a wall in their office a photograph of the congressman in his goalie uniform during a pickup hockey game, with a caption quoting him as saying, “This is not a time for playing games; it’s a time for problem-solving.”

If Mr. Wolfson is viewed as a traitor in some Democratic precincts of New York, his decision to work for Mr. Bloomberg has not stirred the same passions in Washington, where many Democrats — the very people, it should be said, who still pay Mr. Wolfson’s salary at Glover Park — view the mayor as a politically benign figure.

Even former President Bill Clinton gave him a blessing of sorts. “Howard was critical in electing and re-electing Hillary to the Senate, and last year he fought hard for her until the last day of the campaign,” Mr. Clinton said in a statement. “I can see why the mayor wanted him on board.”

But the transition has not been seamless. Mr. Wolfson barely knows the mayor, having met him for the first time only a few months ago, and initially had a hard time keeping Mr. Bloomberg from deviating from the campaign script — no small issue given that Mr. Wolfson’s primary responsibility is the oversight of all campaign-related communications for the mayor.

The mayor exploded with anger publicly on several occasions, including one when he called a reporter “a disgrace.” It was an unfamiliar experience for Mr. Wolfson, who had helped Mrs. Clinton become adept at holding her tongue no matter how strident the attacks on her became.

It has also been intriguing for people to watch Mr. Wolfson explain away things he once declared outrageous, like the mayor’s campaign spending.

On a Friday afternoon in the spring, he gathered a group of reporters in Mr. Bloomberg’s campaign headquarters to share the news that the mayor had spent $18 million in the first few months of his re-election effort. The announcement spurred the kind of questions Mr. Wolfson himself once so pointedly asked, like whether the mayor was trying to buy the election. Mr. Wolfson knocked down the questions in stride, and did not seem the least bit fazed by the contradictions.

“They don’t pay me,” he said in an interview that day, “to disagree with the mayor.”