We got rid of the Swedish king in 1905 by noting that he was unable to form a cabinet (a failure to govern), so swoosh he was gone. Unlike the Danish and Norwegian state union, the Swedish king was also the Norwegian king, but it was not a state union. Norway had it’s own constitution since 1814 where the king just happened to be Swedish. Details matters when playing legal hardball.
A war was averted in 1905 but it was a close call.