Good question
Actually our regulations are simple: you can own weapons only for self defense if you're in the police or military (A type) or if you are under menace of terrorism/some occupations like jewelers (that woulf be a type B license).
license A could also own rifles, shotguns, allí that stuff.
Next are the hunters, license D for rifles, E for shotguns, no handgun allowed. They are easy to get, there are many hunters here.
Last, license F, for sport shooting, you can own handguns, rifles, shotguns.
Just a problem: 7,62x51 is forbidden for use in any semiauto, just like 7,62x39
5,56x45 and 5,45x39 are completely forbidden.
That's why .300 blackout is becoming very popular.
Mags are limited to 20 rounds for pistola and 10 for long guns.
To buy ammo, there is another limitation: 100 rounds per year for handguns and 1000 for long guns, except shotguns....you can buy up to 5000 per year
You can reload, but then you need a F license.
Spain is a safe country but drugdealers are getting ak and that kind of stuff.
As americans usually say, there is no prohibition that can stop bad guys to get guns.....