Genuinely asking here: do you think the word "illegal" means wrong?
By definition, if a sovereign government decides it's allowed to do something, it's not illegal. You could say it's unethical (though I'm not sure why you would), but you can't say it's illegal.