US President Donald Trump said he was prepared to talk to Iranian President Hassan Rouhani but that there was always a chance of US military action against the Islamic republic.
"So Iran is a place that was extremely hostile when I first came into office," Mr Trump told British television station ITV. "They were a terrorist nation number one in the world at that time and probably maybe are today."
When asked if he thought he would need to take military action, he said: "There's always a chance. Do I want to? No. I'd rather not. But there's always a chance."
He said, when asked, that he was prepared to talk to Mr Rouhani: "Yeah of course. I would much rather talk."
Iran and the United States have been drawn into starker confrontation in the past month, a year after Washington pulled out of a deal between Iran and global powers to curb Tehran's nuclear programme in return for lifting international sanctions.
Mr Trump has condemned the nuclear deal, signed by his predecessor Barack Obama, as flawed for not being permanent and for not covering Iran's ballistic missile programme and its role in conflicts around the Middle East. He has called on Iran to come to negotiating table to reach a new deal.
The Trump administration last month sped the deployment of an aircraft carrier strike group and ordered bombers, Patriot missiles and more troops to the Middle East, citing intelligence about possible Iranian preparations to attack US forces or interests. Iran has dismissed the accusations as groundless.
Mr Trump concluded his state visit to Britain on Wednesday with a ceremony in Portsmouth to commemorate the 75th anniversary of the D-Day landings of World War Two.
Mr Trump and his wife Melania dined with Queen Elizabeth II and her family on Monday at a state banquet. He toasted the queen at the dinner and on Tuesday described her as a fantastic person.
Mr Trump also had warm words for Harry after meeting him at Buckingham Palace.
"I think he's a terrific guy. The royal family is really nice," Mr Trump told ITV. "He couldn't have been nicer."