In the years of Spanish history leading up to World War I, Spain was plagued by growing discontent amongst the poverty-stricken working class and the loss of Cuba- a huge blow to Spain's already crippled international presence. As violence raged throughout Europe during World War I, Spain remained outwardly neutral- a stance which hid the extreme domestic turbulance wracking the country behind the scenes.
The internal conflict set the scene for the 1923 military coup led by General Primo de Rivera, who consequently became dictator and all but pushed Alfonso XIII, the king at the time, off of the stage. However, his death just a few years later in 1930 saw the breakdown of the dictatorship, the exile of the king and the beginning - in 1931 - of what became known as the Second Republic.
The Second Republic soon began to give way to internal conflicts and regional divisions; General Francisco Franco saw his opportunity, and so began the Franco years.