The two Vanadrotts cast Cloud Trapeze, so attacked and defeated Machaka's PD during the magic battle phase. You didn't stale, otherwise your army would not have moved back to your home province.
Vanheim then owned the land outside Machaka's capitol after the magic battles phase. So our army moved onto your capitol first, and was defending when your army returned. Nikolai explained this in the thread about castle movement:
http://www.shrapnelcommunity.com/thr...?Number=581842
As for the gold, if you hire mercenaries, and someone takes the province where they were hired (I'm guessing it was your capitol), then you get your money back. So that explains the gold in your treasury.
Anyway, you put up an excellent fight, especially considering you were fighting on multiple fronts!