|The indigenous people of El Salvador resisted the coming of the Spanish in 1524. But it took another three hundred years for them to finally throw off the yoke of Spain, becoming first a jurisdiction of Mexico, and then a member of the United Provinces of Central America. in 1840, after a bloody civil war, El Salvador achieved independence as a republic. Coffee was the mainstay of the country's economy from about 1860 and the country structured its laws such that a coffee oligarchy was created. A reform candidate who won election in 1931 was dismissed by the military which set off a revolt that killed perhaps 20,000 citizens, mostly peasants. But from that period until the 1970s, the country experienced political stability. But in 1979, a military-led coup overthrew the government and a civil war was unleashed that lasted for over 12 years and caused over 70,000 deaths. Peace was officially restored by treaty in 1992.