They differentiate what's legal and illegal, not what's right and wrong. Correlated, perhaps, but not identical.
the law is the "right and wrong" under a nation's sovereign rule. you can feel how you want about it based on whatever moral system you run on but at the end of the day you cannot expect to violate the law and expect said nation to say "okay well that's fine that law doesn't apply to you"
spain has adamantly insisted that catalonia does not have the right to secede under the spanish constitution and catalonia is subject to spain's rule. unless you're proposing a civil war or international invasion of spain to forcibly liberate catalonia they are a subject of spain