It's not what you do, it's why you do it.
Loghain selling people into Tevinter Slaver is a still a bad thing, even if he only did so to fund his army. His decision to imprison/send away the greywarden(s) when they try to help(Which indirectly caused the DR to even be an option), his decision to blame the grey wardens for Cailen's death(Sure, it's true for his perspective he felt Cailen thought he was immortal thanks to the heroic grey wardens were next to him, so not a baseless accusation).
I know he only blamed the Grey Wardens cause he thought they were unnessiscary, as seen in the Landsmeet when he tries to argue that the GreyWardens are phonys. But shouldn't he have known at least that during the first blight, anyone who isn't a GreyWarden won't slay the dragon permenently. Isn't that in a Codex in the game, so shouldn't that been common knowledge. "GreyWarden is the only one who can truely kill a ArchDemon", Maybe he thought those statement were lies, don't remember 100% of what he did say/think.
Your intend can justify your actions, still doesn't mean they are good actions.
Loghain did what he thought he had to do to save Ferelden... Or not exactly.. He only wanted to save the humans of Ferelden and only certain humans... He didn't care about the dwarves and not the Dalish. The city elves he sold into Slavery. Loghain is a interesting character, cause he is one of the most realistic characters in such a situation, grasping after straws to do anything to save HIS people. There have been a few people in history, Our history whom have done the same thing... Sort of.
However, back to the Dark Ritual. Wouldn't it be funny if the OGB were born as a Tranquil.