(CNN) French President Emmanuel Macron and US President Donald Trump have indicated they want to aim for a new deal to curb Iran's regional ambitions and ballistic missiles program that would run alongside the existing international nuclear pact.

Macron, speaking at a joint news conference Tuesday with Trump while on a state visit to Washington, acknowledged a "disagreement" between them on the 2015 Iran deal, which Trump has criticized harshly and repeatedly threatened to ditch.

But, Macron said, "I think we are overcoming it by deciding to work towards a deal, an overall deal that will enable us to deal with the nuclear issue, but also treat it together with another three issues which were not being dealt with so far."

Macron, whose visit to Washington is aimed in part at urging Trump to stick with the 2015 accord, said the Joint Comprehensive Plan of Action (JCPOA) should be seen as the "first pillar" of a broader framework that would also restrict Iran's regional influence, its ballistic missiles and its nuclear activities post-2025, when the existing deal expires.

"I always said we should not tear apart the JCPOA and have nothing else. I think this would not be a good solution," Macron said. "No matter the decision now that President Trump will take, I would like us to work as from now on a new deal with four pillars, including what is already covered by the JCPOA."

Trump -- who opened the day railing against the Obama-era accord as "insane" and "ridiculous" -- has threatened to pull out and reimpose US sanctions on Iran by May 12 unless major changes are made to the agreement, which capped Iran's nuclear program in exchange for relief from economic sanctions.

But he sounded a more conciliatory note as he appeared with Macron, saying: "We can be flexible. You know, in life you have to be flexible, and as leaders of countries, you have to show flexibility."

It remained in question "whether or not it will be possible to do a new deal with solid foundations," Trump said.

"We could have at least an agreement among ourselves fairly quickly," he added. "I think we're fairly close to understanding each other. And I think our meeting, our one-on-one went very, very well."

At the same time, Trump issued an ominous threat should Tehran resume its nuclear program, saying: "If Iran threatens us in any way, they will pay a price like few countries have ever paid."

Macron links new Iran deal to Syria

Earlier in the day, the two men put forward an elaborate show of friendship on the South Lawn, reviewing cordons of troops in formation and recalling the long history between the US and France. The US President and first lady Melania Trump later welcomed Macron and his wife Brigitte to the Trump administration's first state dinner

Macron appealed to that long friendship as he spoke alongside Trump.

"We've spent more than an hour, just the two of us -- and had the conclusions been that the United States of America would walk away from the JCPOA and France would not move, then our friendship would be wasted," he said.

Macron also said France and the United States were working together toward a "convergence of view" on the stability of the wider region and Iran's influence there, before potentially moving on to "a new deal that would include the solution for Syria." Russia and Turkey could be involved in future regional talks, he said.

Trump said he and Macron had talked about his desire to withdraw US troops from Syria in the context of concerns over Iran's activities in the region, saying "we are discussing Syria as part of an overall deal."

France, Germany and the United Kingdom -- key signatories to the Iran nuclear deal, together known as the E3 -- are in the midst of negotiations with the US aimed at assuaging some of Trump's concerns. German Chancellor Angela Merkel arrives Friday to continue the lobbying effort and British Prime Minister Theresa May could follow.

What's in the Iran nuclear deal? Stockpiles & centrifuges: The deal has curbed Iran's nuclear program, reducing its stockpiles of enriched uranium by 97 percent and cutting the number of its centrifuges by two-thirds. Uranium enrichment: It still allows Iran to continue enrichment -- enough for civil use to power parts of the country, but not enough to build a nuclear bomb. Inspections: Iran is required to provide inspectors from the UN's nuclear watchdog access to monitor its declared nuclear facilities. Compliance: Every 90 days, the US President must certify to Congress that Iran is keeping up its end of the deal. If the President does not certify the agreement, Congress has a statutory 60-day period to decide whether to reimpose sanctions. Sanctions: If Iran doesn't comply, US, European Union, and UN nuclear-related sanctions on the Iranian economy would be reinstated. A number of non-nuclear-related sanctions currently remain in place. Sources: White House, State Department, Congress, CNN

German Foreign Ministry spokesman Rainer Breul told journalists Wednesday that Germany's "top priority" was to keep the existing Iran nuclear deal intact. ''Seven states and the EU negotiated the agreement and it cannot be renegotiated or replaced by a subgroup," Breul said. "A new nuclear treaty is not on the agenda."

Ellie Geranmayeh, a senior policy fellow at the European Council on Foreign Relations, told CNN that the E3 and United States appeared to have been discussing a package "which first and foremost keeps the JCPOA in place within the existing parameters" but would replace it with a follow-up agreement once certain terms of the 2015 deal expire.

This follow-up agreement would primarily address Trump's concerns about Iran's regional behavior, she said. But, she added, "that doesn't necessarily mean that they're going to present that as a package to Iran. I think what they're trying to reach is a common transatlantic understanding of how Western policy should be shaped towards Iran."

This is a "last European push" to stop Trump from pulling out on May 12 but there are "no guarantees" it will work, Geranmayeh said. "The President has had a habit with these waivers to take them to the eleventh hour before making up his mind," she said.

Already, some US administration officials have been preparing options for withdrawal from the agreement, hoping to be ready should Trump abruptly make his announcement over Twitter. Macron's visit has been viewed as critical to swaying Trump toward a compromise, rather than the all-or-nothing approach he has previously signaled on the Iran deal.

Iran: 'Grave mistake' for US to pull out

Iranian President Hassan Rouhani urged other countries to support the deal and warned that the United States would be making a "grave mistake" if it pulled out.

"If one day the JCPOA is canceled, we have plans in response, but if one day the US wants to violate the JCPOA it will pay the highest political and moral price at international level," Rouhani said Tuesday.

Iran's Foreign Minister Mohammad Javad Zarif, who visited New York on Sunday, also called on European leaders to back the accord.

"President Macron is correct in saying there's no 'Plan B' on JCPOA," Zarif tweeted. "It's either all or nothing. European leaders should encourage President Trump not just to stay in the nuclear deal, but more importantly to begin implementing his part of the bargain in good faith."

In remarks at the Council on Foreign Relations in New York, Zarif said the US had not held up its obligations under the nuclear deal, leaving ordinary Iranians disappointed.

"People expected the international community to perform the way Iran has performed," he said. While several international assessments have found Iran is complying with the deal, Zarif noted that under Trump the US has yet to issue a single license allowing for US investment in Iran.