 In the 19th century Spain moved into the outlying territories and began investing in their economic development.Treaties with Morocco in 1859, 1860, and 1861 consolidated Spain's growing interests.Although Spain enjoyed the compliance of the Moroccan government, tensions flared between Spanish Army patrols and the local Berber tribes that were hostile to Spain, and over whom the Sultan had practically no control.