The independence of El Salvador to consolidate as a nation with its own laws, is certainly a story that we need to know. According to historians, the first time that the Spaniards tried to dominate this area was in 1524.
This event was a total failure because of the resistance that the Pipil warriors put to force Pedro de Alvarado to retire. However in 1525, this character returned and this time managed to succeed and thus put to the area under the control of the captaincy General of Guatemala, which maintained authority until 1821, after a resurrection in the year of 1811.
In the year 1821, El Salvador and the other Central American provinces declared their independence from Spain. When these provinces were attached to Mexico in the year 1822, El Salvador was opposed, and insisted on autonomy for Central American countries. Guatemalan troops were sent to El Salvador with the mission to enforce the Union but were expelled from that country in June of the year of 1822. Before a possible addition to Mexico, El Salvador consider appended to Americans United States.
But in 1823, a revolution in Mexico ousted Emperor Agustín Iturbide of his power, and a new Mexican Congress voted that the Central American provinces decided on its on its own destiny. That year, the five States of Central America (Guatemala, Honduras, El Salvador, Nicaragua, Costa Rica) under the command of General Manuel José Arce formed what was called: the provinces United Central America.
When this Federation was dissolved in the year 1838, El Salvador became independent Republic.