President-elect Donald Trump’s Twitter attack this week on a union official, followed by his choice of a labor secretary who has criticized new worker protections, has rattled leaders of the American labor movement, who fear unions may be facing their gravest crisis in decades.

On Thursday, Trump announced that he would nominate as his labor secretary Andrew Puzder, a fast-food executive who has opposed additional overtime pay for workers and expressed skepticism about increasing the minimum wage. That followed a pair of Twitter messages Wednesday evening in which Trump attacked an Indiana union leader who had criticized him, saying the official had done a “terrible job representing workers.”

The actions, coming just four weeks after Trump won the presidency in part by wooing union voters with promises of better trade deals and a manufacturing revival, fed fears among national labor leaders that Trump was now planning a broad assault on unions.

“The president-elect campaigned on reaching out to working people, and this is one of a string of nominations that run counter to that,” said Eric Hauser, the AFL-CIO’s strategic adviser and communications director.

The crisis for unions is a combination of direct threats from Trump’s agenda and the knowledge that many rank-and-file workers are sympathetic to his populist message. Exit poll data from the Nov. 8 election shows that Hillary Clinton’s smaller margin of victory among union members, along with Trump’s unusually strong performance, helped him win the White House.

The last time unions faced such an environment was when President Ronald Reagan slashed regulations, named a con­­struction company exec­utive as labor secretary and took on the air traffic controllers union. But, even during that onslaught, unions were in a much stronger position than today — representing 20 percent of private-sector workers compared with 7 percent today.

The list of potential setbacks for the labor movement is daunting. Some union leaders are worried that a Trump administration would attempt to introduce a national right-to-work law — allowing any employee anywhere to exempt themselves from participating in a union — and block unions from deducting dues from paychecks.

Trump also will be able to fill two of the five spots on the National Labor Relations Board, which adjudicates disputes between unions and corporate management.

Some union leaders, who spoke on the condition of anonymity because they were not authorized to speak for the unions, said that labor leaders also fear that a Republican Congress and Trump White House would launch investigations of union finances­ while failing to enforce labor laws when employers underpay workers or violate occupational safety rules.

“The assault on unions, as institutions, is indeed unprecedented in scale,” Georgetown University historian Michael Kazin said in an email. “Even in the 1920s, conservative Republicans did not argue against their very legitimacy.”

Union leaders also fear that Trump could reverse President Obama’s executive orders and regulations aimed at improving pay and other worker conditions.

For example, the Labor Department in May finalized rules to expand overtime pay to workers earning up to $47,476, making an estimated 4 million lower-income people eligible. The rule, which was set to come into effect Dec. 1, was recently blocked by a federal judge in Texas. The Labor Department is appealing, but it’s unlikely that a Trump administration would continue to defend it.

Puzder, who is chief executive of CKE Restaurants, which includes fast-food chains such as Hardee’s and Carl’s Jr., has sharply criticized Obama’s efforts. The overtime rule would affect many low-paying transient jobs such as those in retailing or the fast-food business.

“I can’t imagine someone more unsuited to the job of advancing the interest of working people in America than Andy Puzder,” said Robert Reich, President Bill Clinton’s labor secretary and now a professor of public policy at the University of California at Berkeley.

The business community was, by contrast, pleased with Puzder’s nomination.

“Andrew Puzder is someone with the real-world experience to understand workforce issues and how jobs are created,” said David French, the National Retail Federation’s senior vice president for government relations.

John Feehery, a GOP strategist and president of communications at the lobbying firm Quinn Gillespie & Associates, said Puzder “knows something about how hard the federal government made it to hire people. . . . Obama put more government controls over business and made it more difficult for them to hire.”

Trump’s own views on worker issues have been mixed. He has argued for infrastructure spending to create jobs and to scale back trade deals that might imperil manufacturing workers. But he has also sparred with workers — the National Labor Relations Board ruled earlier this year that Trump’s Las Vegas hotel violated the law when it refused to bargain with a union representing workers there. Trump is appealing.

Likewise, he has sent a contradictory message on the minimum wage. At one point during the campaign, he argued that low minimum wages are necessary to keep the United States competitive, but he later seemed to endorse a higher minimum wage, saying he is “very different from most Republicans.” Later, though, he backed off that position.

A challenge for union leaders as they take on Trump is that many of their members supported him in the election.

Trump has since tried to capi­tal­ize on that. Last week, he traveled to an Indiana factory run by the air-conditioning and furnace company Carrier to celebrate a deal to keep jobs from moving to Mexico, after promising to address the offshoring plans during the campaign.

After Trump’s victory lap, a local union leader at the Carrier plant, Chuck Jones, said that Trump had misled the public about how many jobs were saved at the plant, noting that hundreds would still go to Mexico. After Jones appeared on CNN to criticize Trump, the president-elect fought back on Twitter.

Union leaders are now hoping Trump will undermine whatever support he had among union rank and file.

“Chuck Jones is a man of passion, conviction and integrity who would do anything for his union brothers and sisters,” the AFL-CIO said in a statement. “An attack on him is an attack on all working people.”

Still, the results from the election are humbling for union leadership. In an Election Day survey cited by the AFL-CIO, 56 percent of union members voted for Hillary Clinton while 37 percent voted for Trump. In 2012, Obama won 65 percent of union voters while GOP nominee Mitt Romney won 33 percent.

Much of Trump’s success among union workers probably came in the Rust Belt, although the AFL-CIO would not break out results by state.

In Nevada, by comparison, the Unite-HERE union, which represents hotel, casino and restaurant workers, including at Trump’s hotel, waged an aggressive door-to-door campaign, and Democrats won the state Senate and House, sent the first Latina to the U.S. Senate, and defeated two incumbent GOP House members.

“I don’t sugarcoat things,” said D. Taylor, the union’s president. “I think that the labor movement is very important that we get back to our roots: bread-and-butter issues. Workers want a better deal and we have to show that we’re the best path to that.”

With membership sagging and globalization undercutting U.S. wages, unions and their allies are girding for a tough four years.

“The great and sad irony here is that one of the reasons ­working-class wages have stagnated and in many cases declined over the past 30 years is because of the weakening of organized labor,” Reich said. “Yet that stagnation and decline helped propel Donald Trump into the presidency because so many Americans are fed up with working harder and getting nowhere.”