WASHINGTON — President Trump signaled on Tuesday that he was open to a new arrangement with European allies that would preserve the Iran nuclear agreement by expanding and extending its terms to constrain Tehran’s development of missiles and other destabilizing activities in the Middle East.

Hosting President Emmanuel Macron of France at the White House, Mr. Trump again assailed the agreement made by the Obama administration as “insane” and “ridiculous,” but said he could agree to “a new deal” negotiated by American and European officials if it was strong enough. He made no commitment, however, leaving it unclear whether he will pull out of the agreement by a May 12 deadline he has set to either “fix” the Iran agreement or walk away from it.

At the same time, Mr. Trump signaled more optimism about brokering a nuclear accord with North Korea as he prepares for a summit meeting with its leader, Kim Jong-un, in May or early June. Dispensing with harsh criticism of the past, Mr. Trump even praised Mr. Kim in strikingly positive terms, calling the head of one of the world’s most authoritarian governments “very open and very honorable.”

The discussion with Mr. Macron illustrated how the separate nuclear standoffs with Iran and North Korea have increasingly intersected, with far-reaching consequences for American foreign policy in the Middle East, Asia and Europe. Mr. Trump’s decision next month to keep or dump the Iran nuclear agreement will inevitably influence the anticipated talks with North Korea just days or weeks later as Mr. Kim weighs whether he can reach a deal with the American president.