If you are going to have a war anyways, use that horror as a signpost that tells others "this is what will happen to you" to avoid more wars. If you say "we're sorry, won't happen again" guess what? It will happen again because they will use direct or indirect means to threaten other nations and the by the actions of one dictator millions die. This isn't about justifying war but about preventing it.
One of the first actions of the new Libyan government was to instate the death penalty for blasphemy. Which was then used on anyone from political opposition to women daring to seek education. The government collapsed before any sentences could be carried out, but that's intent to apply repression on a vastly broader scale than Gaddafi cared to.