After the Trump administration announced an unprecedented settlement giving the president and his family immunity from tax audits, the union representing workers at the Internal Revenue Service realized they had a serious problem on their hands.

Many experts believe the immunity deal is flatly illegal. So auditors who honor it and give the Trumps preferential treatment could be violating their oath of office. But those who refuse could face discipline and retaliation, said Doreen Greenwald, president of the National Treasury Employees Union.

Politics: New 'Weaponization' Settlement Terms Free Trump From IRS Audits

"It puts our IRS employees between a rock and a hard place," Greenwald told HuffPost in an interview. "They take an oath of office to follow the law and to uphold the Constitution… Then they'll have this order that is contrary to the law, and so it puts them in a very difficult position."

The union joined a lawsuit as plaintiffs against President Donald Trump's Justice Department last week, arguing that the immunity deal puts its members in an "untenable" position: carry out an unlawful order or risk their jobs.

Greenwald said the legal fight is about preserving the integrity of the tax system.

"Many people think IRS employees decide who they can audit. They don't. They don't get to choose," she explained. "They follow the law. And so this kind of special treatment for a few taxpayers threatens that confidence in the fairness of the system."

Politics: Trump's Immigration Crackdown Looms Over Minnesota's Bruising Senate Primary

Trump won the tax immunity as part of an outrageous settlement Attorney General Todd Blanche crafted in May to resolve a norm-breaking lawsuit the president filed against his own administration over the leak of his tax information during his first term. Along with audit immunity for Trump and his businesses, the deal also sought to create a $1.8 billion "anti-weaponization" slush fund that would enable the president to steer money to his allies, including potentially Jan. 6 rioters.

The group Democracy Forward sued over the fund on behalf of several plaintiffs, including Andrew Floyd, a former Justice Department prosecutor fired for his work on Jan. 6 cases, and a judge forbade the department from running the fund. But the tax immunity deal remains in effect, potentially saving Trump and his family business millions.

Trump's leaked returns showed in 2020 he'd been battling the IRS for years over a questionable tax refund and that an adverse ruling could cost him $100 million.

Like this article? Keep independent journalism alive. Support HuffPost.

The White House did not immediately respond to a request for comment.

Former federal tax officials have argued the immunity deal violates a section of the tax code that prohibits executive branch influence over audits and investigations. In the amended complaint with NTEU as a plaintiff, Democracy Forward argues the deal also amounts to an unconstitutional emolument, giving the president a "tremendously valuable profit, gain, or advantage."

Politics: Darline Graham's Lack Of Experience Could Spell Disaster For Her Senate Run

"This has never happened before, and it should not be happening now," Greenwald said. "Having a tax system that Americans believe in… really requires everybody to be playing by the same rules."

The federal judge that oversaw the case Trump brought against his own government has also said Blanche's tax immunity order "directly contravenes" the law and "acquiescing to any such demand is wholly incompatible" with the duties of DOJ attorneys and IRS officials.

Last month, a top official in the Treasury Department, which oversees the IRS, was ousted from his job after warning White House officials they were at risk of violating the statute, though it wasn't clear if the official's ouster was related to the president's tax returns.

The Senate confirmed Blanche as attorney general last week after he grudgingly agreed to modify the terms of the settlement he created for the president. He put in writing that his order creating the weaponization fund had been rescinded, and the department published an additional memo saying the tax immunity would apply only to Trump, his two older sons and the Trump organization, but not any "affiliates" or "subsidiaries" as envisioned by the original order in May.

Politics: Ex-Trump White House Lawyer's 2 Words On Todd Blanche Should Scare Everyone

Still, two Republicans voted against Blanche. One of them, Sen. Susan Collins (R-Maine), cited Trump's tax immunity first in her explanation: "Mr. Blanche approved an order to shield the President, his sons, and the family business from IRS audits, protections unavailable to other American taxpayers."

Federal unions have been pushing back on the Trump administration since his second inauguration, and the NTEU's lawsuit is a good reminder of why the president has tried to destroy them.

Trump has sought to unilaterally strip hundreds of thousands of federal workers of their collective bargaining rights in what some have called the biggest act of union-busting in U.S. history. The White House instructed IRS management to repudiate union contracts there earlier this year, and the agency has even destroyed union flyers and other decorations, the NTEU alleged in a separate lawsuit last month.

Greenwald said the immunity deal was just another illustration of why IRS employees need to have a voice on the job.

"We have always stood up for our members, and we're going to continue to do that," she said. "This is not a political issue. This is about ensuring that the law is honored."

Ex-'Superman' Star's 'Do Your Thing' Dig At Abdul El-Sayed Backfires In A Flash

Trump Pops Off On 'Black And Brown Voters' And It Sounds Like Total BS

Republican Senators Can't Defend Trump's Tax Immunity Deal