Of course it was illegal. If they lost the war, they all knew they’d be hanged for treason. Fortunately, they won, and the winners make the rules.
Refer to Benjamin Franklin's quote:
"We must hang together, gentlemen...else, we shall most assuredly hang separately ..."