TEHRAN — After the landmark nuclear agreement of 2015, hundreds of European, Asian and even American companies rushed to enter Iran’s largely untapped market of 80 million people, assured by the United States and the other signatories that their investments would be safe for at least a decade.

This month, after President Trump unilaterally pulled the United States out of the agreement, the companies heard a strikingly different message: They have 180 days to leave Iran or face being barred from the United States market and being hit with multibillion-dollar fines and the arrests of their chief executives for disregarding American sanctions.

In a speech on Monday, Secretary of State Mike Pompeo vowed that America would destroy the Iranian economy with new unilateral measures that would be “the strongest sanctions in history.”

It is too early to say how many foreign companies ultimately will pull out of Iran in the face of the American threats. The European Union has made promises to take steps to protect its companies.