Part of the reason for initially supporting Mr. de Blasio’s efforts came from a sense among some union officials, particularly at 1199, that the lack of an organized effort to support Mayor David N. Dinkins during his administration allowed powerful opponents to attack him and ultimately led to his defeat after one term.  “For us, it was ‘we can’t let that happen here,’” said Helen Schaub, the vice president for policy and legislation at 1199. “We supported his agenda, and that’s why we gave the money to the Campaign for One New York.”  The city’s municipal labor unions have largely found common cause with Mr. de Blasio on issues of income inequality and affordable housing that extend beyond the confines of contract negotiations. Union members packed his rally in March after the passage of his affordable housing plan in the City Council.  Hector Figueroa, the president of local 32BJ, which represents private-sector janitors, security guards and others, praised Mr. de Blasio for championing issues like higher wages and paid sick leave.  “The mayor deserves an important amount of credit for putting those issues back in the public arena,” Mr. Figueroa said, “and in that way the unions are more influential because we have someone in City Hall who echoes many of the demands that really drive the unions.”  Michael Mulgrew, the president of the United Federation of Teachers, said that not since the Dinkins administration had his union had as much of a friend in City Hall. “If there’s real hot issues, we’ll talk every day,” Mr. Mulgrew said.  But the de Blasio administration has also clashed with some important labor groups, in particular the transit workers union, which he alienated when his push to protect pedestrians led to the arrest of several bus drivers involved in traffic accidents, and the construction unions, which opposed the mayor’s plan to allow affordable housing to be built by workers earning wages well below union rates.  “There is a self-righteous hypocrisy about de Blasio,” said John Samuelsen, the president of Local 100 of the Transport Workers Union, which represents city subway and bus workers. Mr. Samuelsen criticized the mayor for, among other things, his support for bringing a Wegman’s grocery store to Brooklyn Navy Yard, even though the chain does not use union workers. (He also clashed with the mayor over the plan to restrict horse carriages to Central Park and ban pedicabs in the process.)  Mr. Samuelsen, who said the mayor sought to curry favor with certain unions that could help his re-election effort, lamented that such closeness meant several unions were roped into the investigations into Mr. de Blasio’s fund-raising.  “These trade unions stepped up and did things that are perfectly legitimate to pursue their political goals,” Mr. Samuelsen said. “It’s a shame that he dragged them into this comedy-scene mayoralty of his.”  In the case of the nursing home transactions, which caused controversy because they opened the way for the center to be converted to luxury housing, Mr. de Blasio has repeatedly said his administration was duped by unscrupulous businessmen who gamed the bureaucratic process. But newly released text messages and emails tell a more complicated story: The city’s top officials gave deep consideration to the matter, and the union’s influence was heard loud and clear.  Local 1199 was interested in preserving its members’ jobs and satisfying pension costs — issues that were central enough to be included in a memo about Rivington House, prepared by aides to the first deputy mayor, Anthony E. Shorris, who once consulted for the union.  The memo, drafted in 2014, listed potential options (affordable housing, market housing, a for-profit nursing home) and key stakeholders (“community,” “city,” “1199”). The memo also noted concerns over the $18 million pension liability if the property were sold to anyone other than a health care provider.  A top operative for the union, Kevin Finnegan, got in touch with Emma Wolfe, the mayor’s top aide for intergovernmental affairs. The two had worked together before: Ms. Wolfe was once employed by the union, and Mr. Finnegan was her boss.  “Finally talked to Emma,” Mr. Finnegan wrote to the nursing home operator interested in buying Rivington House, referring to Ms. Wolfe. “Says she is taking care of it.”  That same evening, on Dec. 17, 2014, Ms. Wolfe sent an email to seven top City Hall officials, including two deputy mayors and Dominic Williams, Mr. Shorris’s chief of staff and a former 1199 organizer. The message relayed the union’s concerns over the slow pace of the sale of Rivington House, which was still protected by the deed restriction.  The nursing home owner, Joel Landau, bought the property two months later, and, after the city lifted the restriction, resold it this year for a $72 million profit.  Mr. Landau understood the influence Mr. Finnegan and 1199 held in City Hall, cultivating a relationship with him over months by promising to keep a health care facility at Rivington House and, therefore, preserving the union jobs. Mr. Landau declined a request for comment.  But by December 2014, all but 21 of the 200 union workers at the nursing home had been already been laid off with severance, according to an email from Mr. Landau that was obtained, along with the text messages and other correspondence, via a Freedom of Information Law request from the city’s comptroller, which investigated the deal. The union believed those jobs would return when Mr. Landau’s company, the Allure Group, took over the property and began operating a for-profit nursing home.  That did not come to pass. And because Allure Group owned other health care facilities with 1199 workers, it did not have to pay the stiff pension withdrawal liability, according to a statement from the 1199 S.E.I.U. pension fund.  Ms. Wolfe, while declining to comment on the investigations into City Hall or the union, said in an interview that there was constant communication between City Hall staff members and union officials over many topics, including contract issues and city policies that affect union members, such as affordable housing and paid family leave.  “There’s a collective belief that everyone is working on behalf of the same core interests, and so I think that’s an important bond,” Ms. Wolfe said.  That bond is unlikely to come apart without a serious challenge to Mr. de Blasio in the 2017 election.  “For the unions, winability is a big factor,” said Ed Ott, a former head of the New York City Central Labor Council, an umbrella group for the city’s labor unions. “How he looks after Thanksgiving of this year, rolling into next year, is going to be very important.”  A version of this article appears in print on September 3, 2016, on page A15 of the New York edition with the headline: For Unions and City Hall, Close Relationship Grows More Complicated. Order Reprints| Today's Paper|Subscribe
Early in Mayor Bill de Blasio’s tenure, unions were among his biggest supporters. Now, with the possibility of a re-election fight looming, they are beginning to wonder if they should stick with him.