In 788, about a century after the Arab conquest of North Africa, successive Moorish dynasties began to rule in Morocco. In the 16th century, the Sa'adi monarchy, particularly under Ahmad AL-MANSUR (1578-1603), repelled foreign invaders and inaugurated a golden age. In 1860, Spain occupied northern Morocco and ushered in a half century of trade rivalry among European powers that saw Morocco's sovereignty steadily eroded; in 1912, the French imposed a protectorate over the country. A protracted independence struggle with France ended successfully in 1956. The internationalized city of Tangier and most Spanish possessions were turned over to the new country that same year. Morocco virtually annexed Western Sahara during the late 1970s, but final resolution on the status of the territory remains unresolved. Gradual political reforms in the 1990s resulted in the establishment of a bicameral legislature in 1997. Parliamentary elections were held for the second time in September 2002 and municipal elections were held in September 2003.