1898: In 1898, Spain lost the last of its overseas colonies (Cuba, Puerto Rico and Philippines) but took on Morocco as a protectorate, which was to prove a new source of friction. The nation's delicate economic and social situation was expressed in serious internal tension, with anarchist uprisings in several regions, and street fighting in Barcelona in 1909 and 1917.
1909: The Moroccan war enters a disastrous stage, giving rise to a wave of protest all over the country and sparking off the events of the 'Semana Tragica' in Barcelona.
1914 to 1918: Spain remains neutral in the First World War.
1921: The troops fighting in Morocco suffer the disaster of Annual.
1923: General Primo de Rivera gained power by a coup d'etat (Sept. 13, 1923) and at first he ruled via the army through a Military Directory.
Primo de Rivera's dictatorship solved some of the multiple problems plaguing the country: he ended the war in Africa, developed local governments and presented an ambitious public works programme. However, the attempt to return to a constitutional government by integrating a consultative National Assembly (1926) failed with the rejection of the Drafts of the Constitution of the Spanish Monarchy (1929).