The law legalized online gambling and also paved the way for the creation of the Dirección General de Ordenación Del Juego (DGOJ) to regulate and license operators at the national level. Licensing and regulation of wagering venues was done by the relevant authorities in the 17 autonomous regions until the Gaming Act was passed by the Spanish parliament in 2011. Spain legalized land-based casinos through a royal decree in 1977.