A general strike had begun on 19 April 1944 in reaction to the repressive policies of the President Maximiliano Hernández Martínez, which included acts of civil disobedience by workers, students, and government employees, who refused to attend work or school during the strike. During the strike a member of the police killed the son of a wealthy United States immigrant. The US ambassador demanded an explanation, and the struggling economy also contributed to the pressure on Hernández Martínez, who resigned. Before leaving for exile, Hernández Martínez appointed General Andrés Ignacio Menéndez as provisional president. Although the strike succeeded in ousting Hernández Martínez, its leaders were not organized well enough to form an enduring organization. Hernández Martínez' supporters also succeeded in arresting or exiling many of the leaders of the strike. In October 1944, Osmín Aguirre y Salinas, who had been the director of the National Police, staged a counter-coup along with many other very conservative military officials. He promptly repressed most dissident groups. This repression radicalized the oppression, which armed itself in neighboring Guatemala, which had just overthrown its dictator Jorge Ubico during the Guatemalan Revolution. An armed uprising was launched by students in San Salvador on 8 December, followed by an insurgent attack from Guatemala four days later. Both movements were crushed by the Aguirre government, which thus consolidated its position in power.
Presidency
In early 1945, Aguirre transferred power to Castaneda Castro. In January 1945, Castaneda Castro was elected president, with the backing of the elites that had supported Hernández Martínez. He contested the election as a candidate of Partido Agraria, or the Agrarian Party. He faced no opposition in the election, and the country remained under martial law during the entire process. Castaneda Castro had previously served as the interior minister in the government of Hernández Martínez, as had many of the ministers that Castaneda Castro appointed. The Castaneda Castro government passed a measure that loosened the restrictions on labor unions in January 1946. However, the government did not liberalize its response to strikes; In October 1946, workers from a bakers union and a textile factory led a general strike in the hope of ousting Castaneda Castro from the presidency. The strike was put down by the government, and two hundred workers were arrested. In September 1946, in response to a further strike, Castaneda Castro disbanded all the labor organizations and exiled their leaders. The situation in the country during Castro's government has been described by historian Paul Almeida as a "state of siege. R.V. Elam stated that the governments of Aguirre and Castaneda Castro "reestablished elitist rule, restricted political activity." James Dunkerley has stated that during Castaneda Castro's government, the country saw an economic recovery as the price of coffee rose, even as a return to democracy became less likely as the cold war strengthened anti-communist sentiment. In 1945 Castaneda Castro met Guatemalan President Juan Jose Arevalo to discuss the possibility of a Central American Union. In 1946, the two presidents signed the Pact of Santa Ana, and a year afterward they signed the Pact of the Confederate Union of the Central American States. However, this project was never fully realized. Castro was deposed in a coup in December 1948. The coup was led by many younger military officers.