Netanyahu’s claim that the attack was about preventing an immediate threat to Israeli national security is not just facetious, it’s fictitious. I think it was really an attempt to realign the world behind Israel.
The reason Netanyahu felt he had to do that, even at the cost of starting a full-fledged war, was that Israel had exhausted pretty much all of its options in Gaza after a nearly two-year long genocidal campaign. From military action that has failed to return the hostages, to the new Gaza Humanitarian Foundation “aid centers” [that have so far failed to facilitate widespread ethnic cleansing] — nothing Israel was doing in Gaza seemed to catch on. So Netanyahu did what he has done throughout the past two years: open up another front.
Iran was much easier for him [than other fronts] because the idea that the Islamic Republic must be dealt with using military means is perhaps the broadest, most solid consensus in Israeli politics. I think Netanyahu wanted to make political gains and ensure his personal status and future — above all, postponing his trial — as well as try to drag the world into this conflict by forcing, at the very least, the United States to side with Israel.