It’s about time. Finally, after multiple attacks on U.S. bases and allies, President Trump approved a military response against Iranian-allied militias in Iraq and Syria on the weekend. Mr. Trump has to be prepared to do more if the Iranians decide to escalate.

The Pentagon said U.S. F-15E fighters carried out the strikes on five targets occupied by Kataib Hezbollah, a Shiite militia allied with and armed by Iran. “Iran and their KH proxy forces must cease their attacks on U.S. and coalition forces, and respect Iraq’s sovereignty, to prevent additional defensive actions by U.S. forces,” Pentagon spokesman Jonathan Hoffman said.

Kataib Hezbollah is a proxy arm of Iranian general Qasem Soleimani’s Quds Force and would not have acted against U.S. forces without his approval. The group is responsible for 11 rocket attacks in two months on bases where American soldiers were present. A Kataib Hezbollah attack on Friday on an Iraqi base near Kirkuk killed a U.S. contractor and wounded four American troops.

Had Mr. Trump not responded to these U.S. casualties, he would have invited even more attacks. Mr. Trump’s reluctance to use force in response to previous Iranian attacks is one reason Gen. Soleimani may feel he can get away with more attacks.

Last June Mr. Trump stunned his own advisers when he called off a U.S. retaliatory strike on Iran at the last minute after Iran shot down a U.S. drone. Mr. Trump also declined to act after Iran’s brazen September attack on Saudi oil facilities.