WASHINGTON—Iran has shifted its military strategy regarding U.S. forces in Iraq ahead of the U.S. presidential election in November, reducing the number of rockets launched at bases and potentially withholding its response to the January killing of its top general, according to an intelligence assessment described by U.S. officials.

Some U.S. officials and analysts said Iran and its backed groups are unlikely to launch a provocative attack that could have the effect of rallying U.S. public support for President Trump in the weeks leading up to the election.

“If they do not want to see him re-elected, the worst thing they can do is do something to rile up the American public,” said a U.S. official who follows the region.

While the frequency of rocket attacks launched toward American bases in Iraq by Shiite militias supported by Iran has increased during the past two months, the number and size of rockets used in those attacks have decreased. Where such attacks previously included 20 or more rockets at any one time, they now consist of between three and five rockets, the officials said.

By reducing the number of rockets, Iran may be trying to avoid serious casualties, using the attacks instead to harass American troops and signal Iran’s opposition to the U.S. presence in Iraq.

U.S. military officials have said that Iran is trying to demonstrate that it still poses a threat, but won’t do something that could provoke a U.S. military response—such as killing an American soldier.

“It’s more about messaging and less of a desire to do harm,” one defense official said. Iranian officials didn’t immediately respond to a request for comment.

More National Security News

  • Suspect Arrested for Mailing Ricin Envelope to White House September 20, 2020
  • U.S. Threatens Sanctions for Arms Sales to Iran September 16, 2020
  • U.S. Charges Chinese Nationals in Cyberattacks on More Than 100 Companies September 16, 2020
  • U.S. Set to Sell Taiwan $7 Billion in Arms September 16, 2020

In December 2019, the Trump administration carried out a series of strikes in Iraq and Syria aimed at an Iranian-backed group suspected of launching a barrage of rockets at a base near the Iraqi city of Kirkuk, killing an American contractor.

The new assessment of Iran’s military strategy in Iraq comes as U.S. officials are attempting to divine Tehran’s intentions in the little more than six weeks remaining until the U.S. presidential election. They didn’t describe what, if any, evidence ties recent activity by Iran-backed groups to the U.S. election.

There could be other reasons for Iranian restraint, U.S. officials said. Iran could be focused on its own internal challenges, such as its continuing battle against the coronavirus pandemic and subsequent economic fallout, which has been aggravated by U.S. economic sanctions.

The number of U.S. targets inside Iraq has shrunk as the U.S. has closed bases, consolidating them to places like the Al Asad base and at Erbil, in anticipation of reducing its footprint to 3,000 troops from roughly 5,200. At some of its bases, the U.S. has beefed up its defenses against rocket attacks, and coalition-partnered Iraqi forces could see more attacks as a result of that shift.

Iran wouldn’t want to take action that might prompt the U.S. to change its drawdown plans, as it has long stated it wants to see the U.S. leave Iraq, some observers said.

“What we should expect instead is growing Iranian pressure on the U.S.-backed Iraqi prime minister and his political supporters, who represent the new vector of American pressure on Iran,” said Jennifer Cafarella, national security fellow at the Washington-based Institute for the Study of War. “Iran is not worried about past threats but future ones given that we have ceded the battle space.”

U.S. officials noted there was no immediate major Iranian military response after Bahrain and the United Arab Emirates signed accords last week recognizing Israel, part of a joint effort aimed partly at blunting Iranian influence in the region. But, one official cautioned, “Iran plays the long game.”

Officials said that while Iran may want to lay low ahead of the U.S. election, it is unclear how much control Iran has over its proxies around the region, some of whom have more immediate aims.

Moreover, U.S. officials said they believe ongoing threats remain, particularly to top military commanders like Army Gen. Mark Milley, the chairman of the Joint Chiefs of Staff, and Marine Gen. Frank McKenzie, who heads U.S. Central Command, which is responsible for U.S. military operations from the Middle East to Afghanistan.

Officials said that Iran could view an attack against top U.S. military commanders as a reciprocal response to the killing of Maj. Gen. Qassem Soleimani, the powerful head of the Islamic Revolutionary Guard Corps’ Quds Force, in a January U.S. drone strike in Baghdad.

Some U.S. intelligence reporting suggested that Iranian operatives have weighed assassinating the U.S. ambassador to South Africa, Lana Marks, according to people familiar with the intelligence reporting. It remains unclear, however, how serious the plotting was and whether Iran had taken steps to carry it out. Iran has called the reports baseless and part of a Trump administration disinformation campaign. The intelligence warnings were first reported last week by Politico.

Iran has vowed revenge for Gen. Soleimani’s death. It has other grievances with Mr. Trump, including his withdrawal from the 2015 international nuclear accord with Iran, and a U.S. “maximum pressure” campaign that has reimposed tough economic sanctions.

Mr. Trump, who has so far failed to entice Iran’s leaders into direct talks, predicted on Tuesday that Iran would strike a deal quickly if he is re-elected. Democratic nominee Joe Biden has pledged to rejoin the 2015 nuclear accord, called the Joint Comprehensive Plan of Action, if Iran comes back into compliance with its limits on nuclear work.

Ray Takeyh, an Iran expert at the Council on Foreign Relations, said Tehran’s leaders previously saw little difference between U.S. political parties. But that changed after Mr. Trump’s withdrawal from the nuclear accord, he said, and Iran’s government now views the Democrats as more likely to engage diplomatically and negotiate over economic sanctions.

Mr. Takeyh said he had expected a pre-November retaliation from Iran for Gen. Soleimani’s death.

“I always thought they would do something before the election—something provocative but manageable,” and short of killing U.S. soldiers, Mr. Takeyh said. In Iran’s view, he said, such an attack would “in some ways not necessarily benefit the incumbent” and could help Mr. Biden.

“It’s less likely to happen now,” he said.

Write to Nancy A. Youssef at nancy.youssef@wsj.com and Warren P. Strobel at Warren.Strobel@wsj.com