LONDON (Reuters) - British Foreign Secretary Boris Johnson has appealed to U.S. President Donald Trump not to pull out of the Iran nuclear agreement, saying the deal had weaknesses but they could be addressed given time.

Trump has said that unless European allies rectify “flaws” in Tehran’s 2015 deal with world powers by May 12 he will refuse to extend U.S. sanctions relief for Iran.

Britain, France and Germany remain committed to the accord as is but to address U.S. concerns they want to open talks on Iran’s ballistic missile programme, its nuclear activities beyond 2025 - when key provisions of the deal start to expire - and its role in Middle East crises such as Syria and Yemen.

“It has weaknesses, certainly, but I am convinced they can be remedied,” Johnson wrote in an opinion piece for the New York Times. “Indeed at this moment Britain is working alongside the Trump administration and our French and German allies to ensure that they are.”

Johnson began a two-day visit to the United States on Sunday to try to convince Trump’s administration not to ditch the deal. He was due to meet Vice President Mike Pence and national security adviser John Bolton, although not the president himself.

Johnson said he saw no advantage in losing the “handcuffs” the deal imposed on Iran’s nuclear ambitions and only Tehran would benefit from exiting the deal.

French President Emmanuel Macron and German Chancellor Angela Merkel also have lobbied Trump not to withdraw from the deal the U.S. president has described as insane, with Macron warning it could lead to war.

“At this delicate juncture, it would be a mistake to walk away from the nuclear agreement and remove the restraints that it places on Iran,” Johnson wrote.

“I believe that keeping the deal’s constraints on Iran’s nuclear program will also help counter Tehran’s aggressive regional behaviour. I am sure of one thing: every available alternative is worse. The wisest course would be to improve the handcuffs rather than break them.”

In an interview with Fox News Channel’s “Fox and Friends,” a television program that Trump has regularly touted, Johnson said a regional arms race could be spurred if the nuclear deal was to end and Iran was to become a nuclear power.

“You’re going to have the Saudis wanting one, the Egyptians, the Emiratis,” he said. “It’s already a very, very dangerous state at the moment. There doesn’t seem to me at the moment to be a viable military solution.”