In a boost to his embattled mayoral campaign, John C. Liu, the city comptroller, received the support on Wednesday of the city’s largest public employees union, District Council 37.
The endorsement solidifies Mr. Liu’s credentials as perhaps the most pro-union and liberal of the Democratic candidates. It also represents a bit of a rebuke of William C. Thompson Jr., a former comptroller who got the union’s backing in 2009 and is running again.
Then again, the endorsement was hardly a surprise; many political analysts had been predicting for months, if not years, that the union, which represents 121,000 members, would back Mr. Liu. And, in a hint of the reverence in which Mr. Liu is held by members, he got by far the most rapturous applause during a recent mayoral debate organized by the union.
Yet District Council 37’s political clout remains debatable, especially since other unions, including those that represent teachers, health care workers, hotel workers and building workers, are much more coveted because they are considered to be more influential and better organized politically.
The union also has developed a maverick reputation in recent years in backing candidates with checkered records. In 2012, for instance, the union was virtually alone in backing three state legislators who had already run afoul of the law: William F. Boyland Jr., Shirley L. Huntley and Naomi Rivera.
Still, Mr. Liu, who has been dogged by a long-running federal investigation into his campaign, which has so far netted convictions against two former associates, welcomed the backing.
“This is so personal to me,” said a buoyant Mr. Liu, flanked by union leaders, during an event at City Hall. “We’ve got to get the city out of the hands of the billionaires and the mega-corporations and put it back in the hands of the workers.”
Union leaders cited Mr. Liu’s consistent advocacy for city workers, dating back to his days as a councilman representing Flushing, Queens, as being a key reason he was backed so overwhelmingly. They cited, in particular, his aggressive work in highlighting the Bloomberg administration’s scandal-tarred CityTime project, whose costs ballooned to $700 million from $73 million.
Union officials also said that Mr. Liu had been unfairly targeted by Mayor Michael R. Bloomberg, prosecutors and the political establishment. Some said they believed that recent polls showing Mr. Liu languishing in single digits, and trailing four other Democrats, were skewed. And they vowed, on Wednesday, to do their best to elect Mr. Liu.
“I think they started out trying to undermine the campaign, and we don’t play the game,” said Lillian Roberts, the union’s executive director. “He did nothing wrong. It’s definitely a dirty trick to do that, and we’re very upset about that.”