We can't call Nagasaki and Hiroshima terrorist attacks without defining terrorism, and defining terrorism is something many people struggle with.
If we firebombed Japan's rice fields and fishing fleets, and managed to kill no one in the attacks, would that have been terrorism, or even if not terrorism just as awful? The resulting death toll would have been the same in the end, only this time from starvation.
Let's compare it to the firebombing of Dresden in Germany. Conventional weapons, but the same effect, albeit less intentionally so.
Any comparison or justification relative to Japanese atrocities really is a, "tit for tat, I'll get you back," argument, I agree, but there's also a level of, "it must be stopped," mindset.
Arguably, the vast majority of Japanese had no idea those sorts of things were going on, so they are not responsible. But was there a better way to end the atrocities, given the reality of the circumstances, than to take them straight to the people?
What were the other options?
...
...
There is no doubt that the atomic bombs was chosen largely to announce America's position as a military superpower, but I would argue that doing it that way is also largely what has prevented weapons of mass destruction from being used more frequently since. We could have bombed them with fliers saying, "look to the east on this day," and demonstrated the bomb out to sea, but that would have also demonstrated that we were afraid to use it for real.
In the long run, just as the use of chemical weapons in WWI led to the world agreeing, both in law and in spirit, that they were to be avoided, Nagasaki and Hiroshima showed us the horrors of nuclear warfare, prompting us to forever view them with caution.
As awful as it was, in the long run it worked out well for the world.