For two weeks in May, the U.S. military shadowed two Iranian commercial boats sailing around the Persian Gulf as policy makers in Washington and Tehran traded threats and taunts.

American surveillance kept constant watch on the two vessels after U.S. officials said they saw Iranian forces load missiles into launchers on their decks, according to U.S. officials.

As tensions climbed, the Iranian ships eventually pulled into a harbor and unloaded the missiles that had set off alarms for the U.S. military.

This protracted face-off in the Gulf, details of which haven’t been reported, was the catalyst for a cascade of steps by the Trump administration that have fueled concerns of an armed clash.

While President Trump has said he doesn’t want a war and would prefer to talk to Tehran, the Pentagon is preparing for a confrontation with Iran if events take an ominous turn, the officials said, sending warships, bombers, air-defense systems and troops while the State Department fast-tracks arms sales and withdraws diplomatic personnel.