With fears rising that a wider war could break out in the Middle East, the United States has steadily been moving Navy forces closer to the area, including two aircraft carrier groups and an attack submarine. And it has not been shy about announcing the details, in a clear effort to deter Iran and its allies from more intense attacks on Israel.

Earlier this month, Defense Secretary Lloyd J. Austin III ordered additional combat aircraft and missile-shooting warships to the region.

Two aircraft carriers — the Theodore Roosevelt and the Abraham Lincoln — and their accompanying warships and attack planes are now in or near the Gulf of Oman. Mr. Austin also made public his order to send the attack submarine Georgia to the region, an unusual move as the Pentagon seldom talks about the movements of its submarine fleet. The Georgia can fire cruise missiles and carry teams of Navy SEAL commandos.

The orders came in response to threats from Iran and its proxies in Gaza, Lebanon and Yemen to attack Israel to avenge the assassination of a top Hamas leader, Ismail Haniyeh, in Tehran on July 31.

While the United States has said these moves are to help defend Israel and avert a wider regional war, a senior U.S. official said on Saturday night that the American military was better positioned to address a threat from Iran, and that the Israeli Defense Forces would shoulder the bulk of any defense from attacks carried out by Hezbollah across the border in Lebanon.