The Pentagon has abruptly sent the aircraft carrier Nimitz home from the Middle East and Africa over the objections of top military advisers, marking a reversal of a weekslong muscle-flexing strategy aimed at deterring Iran from attacking American troops and diplomats in the Persian Gulf.

Officials said on Friday that the acting defense secretary, Christopher C. Miller, had ordered the redeployment of the ship in part as a “de-escalatory” signal to Tehran to avoid stumbling into a crisis in President Trump’s waning days in office. American intelligence reports indicate that Iran and its proxies may be preparing a strike as early as this weekend to avenge the death of Maj. Gen. Qassim Suleimani, the commander of Iran’s elite Quds Force of the Islamic Revolutionary Guards Corps.

Senior Pentagon officials said that Mr. Miller assessed that dispatching the Nimitz now, before the first anniversary this Sunday of General Suleimani’s death in an American drone strike in Iraq, could remove what Iranian hard-liners see as a provocation that justifies their threats against American military targets. Some analysts said the return of the Nimitz to its home port of Bremerton, Wash., was a welcome reduction in tensions between the two countries.