Donald Trump’s national security adviser has been working closely with two key senators to prevent Trump from destroying the Iran deal, multiple sources in and outside government tell The Daily Beast.

By Friday, Trump will face a pivotal congressional deadline: whether to again waive nuclear-related sanctions on Iran; or permit their restoration, which would put the U.S. in violation of a multinational deal it spearheaded during Barack Obama’s administration.

According to multiple sources, H.R. McMaster is reprising the role he played last fall: removing a legislative irritant from Trump so that the president can quietly remain in the deal.

This time around, sources told The Daily Beast, McMaster is searching for an agreement, even one just in principle, with the leadership of the Senate Foreign Relations Committee to convince Trump that the president’s decision to “de-certify” Iran’s compliance last fall pressured Congress to modify its terms.

It doesn’t exactly work like that—Congress is not a party to the Iran deal, and so all it can do here is place restrictions, or encouragements, on U.S. policy toward Iran. But multiple sources said McMaster considers that an agreement with Sens. Bob Corker and Ben Cardin that took away the congressional deadlines on Iran that Trump hates would be a face-saving way for the White House to accept the deal.

“ This would be a coup for McMaster and a bailout for Trump. ”

“This would be a coup for McMaster and a bailout for Trump,” said a Republican lobbyist familiar with the talks.

It’s an audacious push that has to coalesce by Friday if it will convince Trump, through Secretary of State Rex Tillerson, to waive sanctions, rather than letting them return to force. France, Britain and Germany have vociferously stated since last fall that they wish Trump to take no action against the Iran deal. Already, U.S. officials are leaking that Trump will wind up waiving the sanctions.

But doing so, and embracing the emerging McMaster-Corker-Cardin accord, would likely pit Trump against his fellow Iran hawks.

Trump campaigned against the Iran deal during his run for the White House, telling the pro-Israel lobby AIPAC that his “number one priority” in office would be “to dismantle the disastrous deal with Iran.” Leaving the agreement in place would be viewed as a betrayal in some corners.

McMaster met with Cardin and Corker, who helm the Senate Foreign Relations Committee, on Thursday of last week, according to Corker’s spokesperson, Micah Johnson. Johnson said that Corker and McMaster have discussed the matter over the phone since then.

Corker told reporters on Capitol Hill on Wednesday that the White House has drafted legislative language on the Iran deal. Multiple sources tell The Daily Beast they expect the bill to signal Congress’ desire to extend provisions of the deal beyond their initial expiration dates in six years.

Sources also said that Corker, Cardin, and McMaster are broadly on the same page regarding the legislation. But few expect an actual bill to emerge before Friday, and several sources believed some provisions are still under negotiation.

Two sources, neither of whom wished to be identified while discussing ongoing negotiations, told The Daily Beast that the provisions would likely yield legislative language focusing on restricting Iranian nuclear activity in the latter years of the Iran deal. That would likely permit Trump to claim he has strengthened the deal. But it may be a toothless measure, since Congress cannot renegotiate the deal’s terms; the European allies largely oppose doing so; and tensions between Tehran and Washington have crescendoed during the recent widespread Iranian protests.

Two other well-wired sources expect the Corker/Cardin deal to include a provision that will kick in six years from now, as aspects of the Iran deal relax and start moving toward expiration. If Iran violates certain terms of its nuclear agreement after that point, then the Corker/Cardin deal would impose a 90-day countdown clock. Congress will have a decision: Either it will vote to block the return of punishing American sanctions on Iran, or—after the 90 days—those sanctions will automatically snap back.

Sources say a remaining question is whether Congress will need 50 or 60 votes to keep the sanctions from being reimposed, and that they expect it will be a 50-vote threshold.

“ Embracing the emerging McMaster-Corker-Cardin accord would likely pit Trump against his fellow Iran hawks. ”

The deal is the top diplomatic accomplishment of the Obama administration, and secured through the still-enthusiastic participation of France, Germany and the United Kingdom, all of whom continue to argue that the deal is the best mechanism to prevent a nuclear Iran. China and Russia also backed the deal.

But a chorus of right-wing voices, particularly in Congress, consider the deal to merely delay Iran’s development of nuclear weapons, despite the International Atomic Energy Agency’s consistent findings that Iran is in compliance with the accord’s restrictions.

Already, Iran hawks are telegraphing vociferous opposition to the Corker/Cardin/McMaster deal. Richard Goldberg, the former national security advisor to Sen. Mark Kirk who helped craft American sanctions on Iran, wrote in a Dec. 11 Foreign Policy op-ed that “it’s increasingly clear we are headed for a legislative train wreck.”

Chief among their criticisms is that the legislation makes it too easy for Congress and the White House to shield Iran from current or future sanctions. Critics also argue that American sanctions will be less potent in six years, assuming Iran will experience economic growth in the interim.

Tom Cotton—perhaps the Senate’s most dogged Iran hawk and potentially Trump’s next CIA director—recently met with McMaster to discuss Iran, and a source familiar with that meeting described it as a “train wreck.” The Washington Free Beacon on Wednesday quoted a source close to the negotiations saying, in frustration, “Corker-Cardin will be opposed by most everyone on the right.” Other sources told the conservative news site that the current negotiations will “ limit the ability of Trump and future presidents to ever exit the deal.”

Just because McMaster, Corker, and Cardin are on the same page doesn’t mean the legislation is set. Cardin would still need to sell his Democratic colleagues on any legislation, and sources tell The Daily Beast he is not speaking on their behalf in conversations with Corker and McMaster. At the same time, the White House would need to shore up support from Senate Iran hawks—which could prove extremely difficult.

A spokesperson for the National Security Council did not respond to a request for comment.