One group, including Secretary of State Mike Pompeo and Robert C. O’Brien, the national security adviser, urged a tough response to rocket attacks that had killed two American troops at a base north of Baghdad, arguing that tough action while Iran’s leaders were battling the coronavirus ravaging the country could finally push them into direct negotiations.

But Defense Secretary Mark T. Esper and Gen. Mark A. Milley, the chairman of the Joint Chiefs of Staff, pushed back. The Pentagon and intelligence agencies did not have clear evidence that the attacks, launched by the Shiite militia group Khataib Hezbollah, had been ordered by Iran, they argued, and warned that a large-scale response could draw the United States into a wider war with Iran and rupture already strained relations with Iraq.

The military’s position prevailed, at least for the time being. Mr. Trump authorized airstrikes against five militia weapons depots inside Iraq, carried out at night to limit the possible human toll.