President Donald Trump, US First Lady Melania Trump departs Number 10 Downing Street during the second day of his state visit on June 04, 2019 in London, England.

President Donald Trump said there is "always a chance" the U.S. could take military action against Iran, but he would much rather hold talks with President Hassan Rouhani.

Speaking to British television station ITV in an interview published on Wednesday, the U.S. president said: "Iran is a place that was extremely hostile when I first came into office... They were a terrorist nation, number one in the world at that time and probably maybe are today."

When asked whether he thought he would need to take military action against Iran, Trump replied: "There is always a chance. Do I want to? No, I'd rather not. But there's always a chance."

Later in the interview, when asked if he would prefer to hold talks with Iran's president, Trump said: "Yeah, of course. I would much rather talk."

Iran and the U.S. have been drawn into starker confrontation in recent weeks, stoking concerns about a potential conflict.

It comes a year after Washington pulled out of a deal between Tehran and global powers to curb its nuclear program in return for lifting international sanctions.

The U.S. re-imposed sanctions on Iran last year, before ratcheting them up further in May, ordering all countries to cut off imports of Iranian oil.

In the past month, the U.S. has hinted at military action in Iran while the Trump administration has said it has built up its military presence in the region.

On Saturday, Iran's President Hassan Rouhani suggested Tehran would be willing to hold talks if Washington showed respect, but the country would not be pressured into talks.