The September 11 attacks were a surprise mass murder of civilians designed to create terror. Fighting and killing the people who did that is about the clearest case of justified war I can think of.
The United States mobilized to find Al Qaeda, especially its leader Osama bin Laden, and capture or kill them. We asked the government that was harboring Al Qaeda, the Taliban regime in Afghanistan, to help us, or at least get out of the way. They considered it, but decided to continue sheltering our enemy. That made the Taliban an enemy too. We removed the Taliban regime in order to get at Al Qaeda.
When bin Laden fled to Pakistan, we made the same request of the Pakistani government. They decided to help us find Al Qaeda. We learned, the hard way, that some Al Qaeda sympathizers within the Pakistani government were tipping off the enemy, so we cut back on what information we shared with the Pakistani government. Finally, after a long search and excellent intelligence gathering, we found Osama bin Laden. We sent in a small team of Americans who captured and killed the enemy. They did not kill civilians, and none of our guys were lost. Bin Laden's corpse was identified, given Muslim funeral rites, and buried at sea to prevent anyone making a shrine of his grave.
That is doing war the right way.
The many distractions that were added by opportunists to this basic story were huge costly mistakes, designed to serve personal or venal interests. But those mistakes should not distract us from the clear narrative of the right war fought the right way.