President Biden’s plan to require federal workers to get vaccinated or face regular testing and other restrictions has splintered groups representing large numbers of employees, raising questions about compliance as the White House attempts to arrest the spread of the coronavirus delta variant.

Some sectors of the federal workforce, including groups as disparate as law enforcement officers and postal workers, raised concerns about the requirement, sending an early signal of looming problems. The directive is expected to apply to some 4 million federal workers.

The Federal Law Enforcement Officers Association, which represents more than 26,000 federal officers, has blasted the idea, saying that it believes requiring vaccinations represents an infringement on civil rights.

“There will be a lot of pushback. It’s going to be an avalanche,” President Larry Cosme said, warning that many of the group’s members at the Justice Department and the Department of Homeland Security would be opposed.

Rather than try to force employees to get vaccinations, Cosme said, the government could offer financial or other incentives to employees who get vaccinated.

Similarly, the American Postal Workers Union said that it was opposed to required vaccinations for postal workers, saying in a statement late Wednesday that policies related to vaccination and testing must be negotiated individually with the union.

Even some traditionally left-leaning unions have also shown resistance.

The American Federation of Teachers, which represents nearly 200,000 health-care workers who could be affected by vaccination mandates in places such as California, released a statement saying that mandatory vaccinations must be part of the collective-bargaining process between unions and government leaders.

“In order for everyone to feel safe and welcome in their workplaces, vaccinations must be negotiated between employers and workers, not coerced,” said the union’s president, Randi Weingarten, typically a prominent liberal ally. “We believe strongly that everyone should get vaccinated unless they have a medical or religious exception, and that this should be a mandatory subject of negotiation for employers to keep their employees safe and build trust. But healthcare professionals are concerned that mandating vaccines outside contract negotiation will only result in more people leaving the bedside at a time when staffing levels are already low from the trauma of the past year.”

The American Federation of Government Employees and the Professional Managers Association, which represents thousands of IRS managers, said the proposal could require the government to engage in a bargaining process with its employees.

The proposal is garnering support among some unions however, such as the International Federation of Professional and Technical Engineers, an AFL-CIO union that represents some 25,000 federal workers at agencies such as NASA and the Defense Department.

The union said it would embrace a mandate because of the safety and security it would provide to its members.

“We’re in the middle of a pandemic, over 600,000 people are dead, and we don’t want any more of our members dying,” said Paul Shearon, the union’s president.

Biden formally announced the plan Thursday, saying that it would apply to “all federal personnel” and visitors to federal buildings, marking a significant shift in the government’s steps to control the pandemic.

“Make no mistake — vaccines are the best defense,” he said. “We can do this. We just all have to do our part.”

Those who are not fully vaccinated would be required to wear a mask at work, physically distance from other employees and visitors and undergo weekly or twice-weekly testing.

The policy falls short of a strict mandate, providing options for people who still prefer to avoid vaccinations. Dan Meyer, a managing partner at the firm Tully Rinckey and an expert on federal employment law, said this nuance was an attempt to avoid an even larger and more complicated backlash.

“This is trying to split the difference,” he said. “This is trying to get to something that’s in the middle, short of get stuck or don’t get stuck. … They’re trying triangulation to make everyone happy, but I think in the end it’s going to make nobody happy.”

Many federal workers said in interviews that they supported the government’s attempts to increase vaccinations among their colleagues.

John Garrity, an installation coordinator for the Navy who has worked on ships for about 33 years, said he saw requiring vaccinations as a simple issue of safety and responsibility.

Garrity is fully vaccinated, having received his shots at Pearl Harbor in April. But he said he remains at high risk, as a 57-year-old with diabetes and with three children in his household.

He is based in Philadelphia but works all over the country — having recently done a work stint in Jacksonville, Fla. — and said he comes into contact with a couple dozen people most days on the job.

“There’s a lot of folks out there that don’t want to get vaccinated, and I think it’s time that it becomes a condition of employment — to protect everybody,” he said. “That’s why the president’s doing what he is doing. His hand is kind of being forced now.”

A worker at FCI Herlong, a medium-security prison run by the federal government in California’s Sierra Nevada mountains, said he was deeply opposed to the mandate.

The man, in his 50s, is not vaccinated and spoke on the condition of anonymity because of concerns about retaliation. He said he felt the issue was one of personal freedom.

“It ain’t about right or wrong — it’s about choice to me,” he said.

He said he would be willing to put up with testing mandates, even onerous ones, should it come to that, but said he hoped those would not cost him extra money. And having worked for the federal government for many years, he said he would not be surprised if it backed down in the face of pushback and opposition.

“I have seen the government go so hard, but once they get resistance, good old-fashioned lawsuits and wardens not wanting their names on that lawsuit, policies change like nothing,” he said. “It is what it is.”

Michael Arendt, who works with the Army Corps of Engineers at a federal lock and dam in Alabama that is staffed around-the-clock, disagreed, saying he saw vaccinations as a way of keeping the country — and its essential services and workers — running.

“We have to get that to keep America moving,” he said. “If not, we’re going to put our critical infrastructure at risk for not having people that can come in 24/7.”

Arendt, who cares for his 99-year-old father, a World War II veteran, also said such steps were important to those who care for vulnerable family members, like himself.

Will Kohler, a tax examiner and union steward in his early 60s at the IRS in Cincinnati, said that he was in strong favor of the mandate, saying that employees at the IRS, some of whom had to go into work throughout the pandemic, had been hit hard by the virus.

“You have to get a shot if you go to a lot of foreign countries and you have to have your shot if you want to go to school — it’s no different,” he said.

He still works from home but said he would be concerned about returning to the office if others around him were not vaccinated.

“I don’t want to have to go in and sit next to someone who is not vaccinated — you can still get sick,” he said. “If that person is going to pay my doctor’s visits, that’s fine. But if they’re going to let unvaccinated people in there, they need to come up with some special dispensation for some of us who are vaccinated. There’s no excuse not to be vaccinated now.”

The plan Biden announced Thursday is part of an aggressive shift at the White House in recent days as the delta variant has spread markedly through parts of the United States, particularly among unvaccinated Americans.

Public health experts have long said that getting at least 70 percent of the public vaccinated would be the single most important tool in controlling the pandemic, but some parts of the United States have fallen far short of that target. And some authorities are urging an even higher rate of vaccinations now, given the increased virulence of the variant.

Many questions remain about the specifics of the White House’s plan, which could apply to anywhere between 2 million and 10 million federal government employees. It will not apply to members of the military at the moment, but Biden said that he would ask the Defense Department to examine adding coronavirus vaccination to the list of inoculations that military members are already required to have.

The new rules closely align with policies recently put in place for government officials in California and New York City — where employees are required to get regular testing if they refuse to get vaccinated.

The Centers for Disease Control and Prevention’s new mask guidance is also reverberating through the federal workforce.

On Wednesday afternoon, the Biden administration altered its posture on wearing masks at the Defense Department, saying that vaccinated and unvaccinated people must wear a mask indoors in any department facility where there is “substantial” or “high” transmission of the coronavirus.

The government defines substantial transmission as 50 cases per 100,000 people — areas that cover vast swaths of the country, including Washington. Presently, only a handful of states have fewer than that.

The Equal Employment Opportunity Commission issued guidance in May that said employers could mandate vaccinations for workers to work on-site, as long as they do it in ways that do not run afoul of civil rights and disability statutes. And the Justice Department has also determined that federal law does not prohibit public and private employers from requiring vaccinations, even if vaccines have been approved only for emergency use by the Food and Drug Administration.

Dan Lamothe and Devlin Barrett contributed to this report