Britain's foreign minister says Iran is a major regional player that can be an ally in fighting terrorism — but the U.K. must "tread carefully" in its relationship with Tehran.

Tehran and world powers struck a deal last month on Iran's contested nuclear program, and on Sunday Britain and Iran reopened their respective embassies after a break of several years.

Foreign Secretary Philip Hammond, who met Iranian President Hassan Rouhani in Tehran Monday, said the two countries shared common ground despite a "deep legacy of distrust."

He said they agreed on the need to defeat the Islamic State group, and to stop opium from Afghanistan reaching Europe.

Hammond told the BBC that "Iran is too large a player, too important a player in this region, to simply leave in isolation."