I can. The treasury was nearly bankrupt due to the civil war the Bannorn started and Howe's embezzling.
You mean the Civil War that Loghain helped start by appointing himself regent right after leaving their king to die, and refusing to step down even when they made their unrest clear and threatened to go to war if he didn't do so. He could have ended the civil war before it started by stepping down from the regency, and letting Anora handle politics while he handled the armies. He could have followed Anora's advice instead of brushing her aside (it's not like she has experience with ruling or politics or anything) and continuing to try to shove a square peg into a round hole. ("Shouldn't we be fighting the darkspawn instead of each other?" Loghain: "The nobles need to be brought to line, and then the darkspawn." Later: "We need help, Father!" Loghain: "Ferelden will stand on its own two feet!")
And Howe's embezzling? No sympathy from me, since it was only possible because Loghain himself appointed Howe and didn't keep an eye on him.
Couple that with the lack of the Circle on his side (as Lucrosians/Formari could be good for bumping up the war chest) and perhaps even the lack of Orzammar as well (a place to trade with) he needed a quick fix. Howe suggests to him that he engage with the Tevinters and sell the Elves to them to get the war chest back up (given Howe's attitude towards Elves it's likely he floated the idea to Loghain more then Loghain just thought "Hey! I'll sell the Elves!").
Loghain signed off on it (which is still something to hold him accountable for) and a few dozen Elves were shipped out by the time the Warden stopped it, and the treasury was only 1/3 full (as Loghain points out). His mind is to the point where the nation is about to be lost due to the Blight that he couldn't stand against when he wanted to (after Ostagar) because he had to focus on a bunch of short-sighted fools, and he figures that the Elves would be better off alive and living as slaves then dead in the part of Denerim that is extremely indefensible (despite having a wall it is actually the worst part of the city structurally speaking) and without hope.
Loghain will even tell you that his plan was to get the treasury completely full through this method, resupply the army, and then supply the remaining Elves in the Alienage so they could defend themselves.
Now, I don't think the quest was done all that well -- as it's more for shock value and quickly forgotten about and it goes back to the player fantasy thing I was talking about (as the larger reasons leading to it are only brought up by Cauthrien and Loghain, both of whom can be killed -- but the basic premise I can understand.
Even though he suffered under the weight of Orlesian oppression where they sold Elves like cattle (more for the lulz then any reason like Loghain had) and he took the Night Elves under his wing.
That, and Loghain's a two-faced hypocrite that thinks subjugation is only unforgivable when it happens to him and his.
Orlais occupying Ferelden? UNACCEPTABLE! Tevinter enslaving elves? Oh okay, that's a necessary evil. Orlais selling elves into slavery? THE BASTARDS! Loghain flat-out selling elves into slavery? Oh, well, he needed the money. Possibly compromising Ferelden's human citizens' future freedom by accepting "Orlesian" aide (Grey Wardens, Chevaliers, or both)? NEVER! It's better for Ferelden to die fighting darkspawn for their freedom than live under occupation again! Flat-out selling elves into slavery to their own former oppressors? Of course it's fine! Loghain himself says in-game (words to the effect of) "Isn't it better to live as slaves than die fighting darkspawn?" Yeah, sure, Loghain. Tell me again how you accepted "Orlesian" aide to save human lives. Oh wait, you didn't. Because human freedom is non-negotiable while elven freedom is. Humans deserve the dignity to fight and die for their freedom while elves can get sold like chattel to ensure human freedom.
On the bolded: The entire city of Denerim is surrounded by high stone walls. If the darkspawn were to penetrate the outer walls and flood into the streets, everyone inside would be like ducks in a barrel. (Except those in the castles; the prison, Arl of Denerim's estate, the royal castle, etc.) So, no. I don't buy that as an excuse. Just another self-deluding rationalization.
I think it more comes down to this: Loghain could have ended the civil war by stepping down from the regency like the nobles demanded, and/or let Anora handle politics so he wouldn't make more enemies by sneering down his nose at them or ordering them to shut up and get back in line. But he didn't. To quote a hardened Alistair, "That's the problem with Anora: She's just like her father. They think they alone know what's best for Ferelden, and everyone else needs to just get out of the way." But while Anora will use diplomacy and ally with others when she needs help (like the Warden), Loghain will have none of that. It's his way or no way, and he'll fight the Bannorn however long it takes to try to force them to submit to his regency, and he will sell elves into slavery to pay the civil war to ensure his own regency. He'd rather sell his own people into slavery than admit he made a mistake and compromise his plan by stepping down from political power, or accepting aide from someone else. He sold them to feed his own stubbornness and pride, so I cannot forgive him.
Loghain excuses all of his crimes with, "Everything I have done has been to ensure Ferelden's freedom." As far as I'm concerned, that excuse flies out the window the second he starts selling his own citizens into slavery.