CIA director Gina Haspel foresaw the Iranian missile attack on two Iraqi military bases housing U.S. troops but said that killing Iranian Gen. Qassem Soleimani was worth the risk.

The New York Times published a detailed look at the hours leading up to Tuesday's strike, in which Iran fired more than a dozen ballistic missiles toward targets in Iraq. No one was hurt or killed in the incident, which U.S. officials believe was a result of intelligence received before the strike took place.

According to the Times, Haspel told President Donald Trump days before Soleimani was killed in a U.S. drone strike last week that taking him out and dealing with the expected retaliation from Iran posed a lower threat than leaving him alive to plot more attacks against the U.S. and its allies.

What's more, Haspel said that Iran would likely respond to Soleimani's killing by sending a barrage of missiles at Iraqi military bases — which is exactly what happened Tuesday night.

Haspel also said that a world without Soleimani — who led Iran's elite Quds Force, which handles military and spying operations in foreign countries — would lead to a more stable situation in the Middle East.

The White House received an urgent alert from the U.S. intelligence community roughly three hours before Tuesday's missile attack, saying it was likely Iran was about to strike back at the U.S. by attacking the Iraqi bases where U.S. troops were stationed. According to the Times, that gave the military time to move some assets away from the bases, evacuate some personnel, and move others to fortified locations.

Wednesday morning, Trump addressed the nation and said he was relieved that no one was killed in the attack and that his administration would step back from further military escalation with Iran.