The reason for that is, that EU family law is pretty liberal. And EU law is "higher" then local law. But that only applies if you executed your European right.
To execute your European right, you must have lived for 3 month in another EU country. Or simply marry in an other EU country which is not your own country.
I'm writing this from experience. As this was the way my wife (Saudi) and I (Austrian) did it. I did first study in Denmark. Therefore executing my EU right.
https://europa.eu/youreurope/citizens/residence/documents-fo...