don't know a solution but this one isn't it
Machiavelli in Discourses on Livy says you are inviting an overthrow of your government by doing this.
The mercenaries can flip sides if the opposite faction pays them and offers them better terms... or maybe the mercs just flip.
Hard to say how true this is.