Washington (CNN) As President Donald Trump considers whether to withdraw from the Iran nuclear deal, Secretary of State Rex Tillerson is working behind the scenes with Congress to head off the possibility of an international crisis ahead of the agreement's looming October 15 certification deadline, several US officials and Western diplomats told CNN.

Tillerson and congressional lawmakers are spearheading efforts to amend US legislation regarding Iran to shift focus away from the nuclear issue -- a move that could allow the US to stay in the multilateral nuclear deal forged in 2015 and also push back against Iran's other destabilizing behavior, officials and diplomats said.

"Tillerson has said the problem with the JCPOA is not the JCPOA," one senior administration official said, using the acronym for the 2015 nuclear deal, known as the Joint Comprehensive Plan of Action.

"It's the legislation," the official said. "Every 90 days the president must certify and its creates a political crisis. If the administration could put the nuclear deal in a corner, everyone could happily get back to work on dealing with everything else that is a problem with Iran."

On the surface, a plan to keep the US in the deal by taking a harder line on Iran through legislation seems to run counter to Trump's indications that he prefers scrapping the agreement.

But several US officials have told CNN that the White House has seemed open to the plan -- suggesting that Trump could be changing his approach to the myriad of issues related to Iran.

Trump has long railed against the deal President Barack Obama struck with Iran to curb the nation's nuclear ambitions. He used it as a foil against Hillary Clinton during the 2016 campaign. During his first address to the United Nations General Assembly last month, Trump labeled the deal "one of the worst and most one-sided transactions the United States has ever entered into."

Trump has said publicly he "decided" how he is going to proceed on the Iran nuclear deal but declined to disclose his decision, teasing to a future date.

The Trump administration is wrapping up a months-long review of US policy toward Iran and Trump has hinted at a series of events that he favors leaving the deal despite a more cautious message from several congressional Republicans, Tillerson and Defense Secretary James Mattis.

Mattis at the Senate

During a hearing before the Senate Armed Services Committee on Tuesday, Mattis said that he believes it is in the US national security interest to remain in the Iran nuclear agreement.

Sen. Angus King asked Mattis: "Do you believe it is in our national security interest at the present time to remain in the (agreement)? That is a yes or no question."

Mattis replied, "Yes, senator, I do."

"The point I would make is if we can confirm that Iran is living by the agreement, if we can determine that this is in our best interests then clearly we should stay with it," Mattis added. "I believe at this point in time absent indications to the contrary, it is something the President should consider staying with."

But Mattis went on to explain that he also supports a rigorous review of national security issues related to Iran that may fall outside the exact terms of the agreement.

"The President has to consider more broadly things that rightly fall under his portfolio of looking out for the American people in areas that go beyond the specific letters of the JCPOA -- in that regard I support the rigorous review that he has got going on right now," he said.

Making the case

Tillerson floated the broad brushstrokes of his plan to foreign ministers whose countries are party to the deal -- Britain, France, Germany, Russia, China and Iran -- last month in New York on the sidelines of the UN General Assembly.

All the ministers had argued that the nuclear deal was designed to address issues solely related to Iran's nuclear program, according to several diplomats who attended the meeting.

By all accounts -- even that of the United States -- Iran had lived up to its commitments under the agreement, and European leaders signaled they were not interested in expanding the scope of its implementation, they said.

"Tillerson believes the deal is politically unsustainable in the United States because the Obama administration -- which negotiated the deal -- was voted out of office," one official said. "So he is working on a play to see if we can change the political dynamic in the US by changing the legislation."

Iran's foreign minister also said he faced political difficulties at home in trying to defend the deal.

Tillerson's strategy centers around trying to compartmentalize the Iran deal by amending the legislation.

Instead of certifying that Iran is meeting its technical commitments under the nuclear deal, the administration would report to Congress regularly about broader aggressive Iranian behavior -- such as support for terrorism and its ballistic missile program -- and what the administration is doing to counter it.

This approach could allow the US to stay in the deal but help Trump avoid the political headache of having to re-certify it every 90 days.

It might also keep the Europeans, who want to keep the deal, on board with administration efforts to fight Iran's other destabilizing activities.

Congress' role

Central to the effort is Senate Foreign Relations Committee Chair Bob Corker, an early opponent of the deal who teamed up with committee co-chair Sen. Benjamin Cardin (D-Md.) in 2015 on bipartisan legislation that gave Congress the power to review the final agreement.

On Tuesday Corker confirmed to CNN he was working with the administration on a plan for Iran, but declined to discuss details of the proposal.

"I'm working very closely with the administration on something I just can't talk about publicly," Corker told CNN, saying he was "too close to the situation" to discuss specifics.

Last week, Corker said he has been "working hand-in-glove" with the Trump administration on the issue "and (has) been for some time."

But the efforts of Tillerson and Corker could face opposition from lawmakers like Republican Sen. Tom Cotton who advocated on Tuesday for denying the deal's certification, calling the agreement "a direct national security threat."

Cotton urged Trump to continue to insist the deal be revised under the threat of withdrawal in a speech to the Council on Foreign Relations saying: "The world needs to know we are serious, we are willing to walking away, and willing to reimpose sanctions."

Limits on Iran

Western diplomats said they are talking with the Trump administration about deepening cooperation pushing back against Iran's other activity, such as its ballistic missile program, its support for terrorism and its actions in Syria, Lebanon and Yemen.

French President Emmanuel Macron said in New York after meeting with Trump on the sidelines of the UN General Assembly that Iran's increased influence in the region called for greater attention to Tehran outside the nuclear deal.

Macron, whose country was among the toughest negotiators during the talks over the Iran deal, said he would be prepared to discuss further sanctions over Iran's ballistic missile tests, as well as discuss Iran's growing influence in the region and amendments to the nuclear agreements over what happens when the deal expires in 2025.

"Let's be honest, the tensions are on the rise, look at the activities of Hezbollah and Iran's pressure on Syria. We need a clear framework to be able to reassure regional countries and the United States," Macron said.

"More can be done and we are ready to it," another European diplomat said. "Just because we want to keep the JCPOA doesn't mean we want to ignore the other concerns," one European diplomat said. "We can do this in parallel. We agree we should look at the global picture but we don't want to throw the baby out with the bath water."

Diplomats noted that the Iran deal has a "snap back" provision in which the international community can re-impose sanctions if Iran doesn't implement the deal.

Trump the wild card

Still another European diplomat also disputed the notion that Iran can automatically go back to developing its nuclear program without restrictions after the deal expires.

This diplomat noted that Iran also still belongs to the Non-proliferation Treaty, with increased inspections under the so-called "Additional Protocol."

"It doesn't mean it's an open bar afterward." the diplomat said. "It is the wrong perception that Iran can do whatever it wants."

The US decision whether to stay in the Iran deal also sends a message to North Korea that it is in their interests to reach a nuclear deal of its own, the diplomat said, asking, "why would North Korea or China agree to reach a deal if the US can't keep its commitments?"

Despite Tillerson's strategy and behind the scenes work, Trump remains a major wild card that could ultimately determine how the situation plays out.

"We are about to witness a master stroke of diplomatic and political genius or it could all fall apart," one senior administration official told CNN about Tillerson's plan. "Who knows which way it will go?"