In 1854, a civil war erupted in Nicaragua between the Legitimist party (also called the Conservative party), and the Democratic party (also called the Liberal party). The Democratic party sought military support from William Walker who, to circumvent American neutrality laws, obtained a contract from Democratic president President Castellón to bring as many as three hundred "colonists" to Nicaragua. Walker sailed from San Francisco on May 3, 1855, with approximately 60 men. Upon landing, the force was reinforced by 170 locals and about 100 Americans.
With Castellón's consent, Walker attacked the Legitimists in the town of Rivas, near the trans-isthmian route. He was driven off, but not without inflicting heavy casualties. On September 4, during the Battle of La Virgen, Walker defeated the Legitimist army. On October 13, he conquered the Legitimist capital of Granada and took effective control of the country. Initially, as commander of the army, Walker ruled Nicaragua through puppet President Patricio Rivas. U.S. President Franklin Pierce recognized Walker's regime as the legitimate government of Nicaragua on May 20, 1856.
Walker had scared his neighbors with talk of further military conquests in Central America. Juan Rafael Mora, President of Costa Rica, rejected Walker's diplomatic overtures and instead declared war on his regime. Walker sent Colonel Schlessinger to invade Costa Rica in a preemptive action, but his forces were defeated at the Battle of Santa Rosa in March 1856. In April 1856, Costa Rican troops penetrated into Nicaraguan territory and inflicted a defeat on Walker's men at the Second Battle of Rivas, in which Juan Santamaría, later to be recognized as one of Costa Rica's national heroes by burning the place were the Filibuster were staying. Walker set himself up as President of Nicaragua, after conducting an uncontested election. He was inaugurated on July 12, 1856, and soon launched an Americanization program, reinstating slavery, declaring English an official language and reorganizing currency and fiscal policy to encourage immigration from the United States of America.
Meanwhile, government representatives from Honduras, El Salvador and Guatemala signed in the City of Guatemala a Treaty of Alliance on July 18, 1856, for "defense of its sovereignty and independence" also recognized Patricio Rivas as president of Nicaragua. Costa Rica could not attend at that time to the alliance because of the havoc that cholera disease had caused in their troops, but would resume actions later. Also, democratic and loyalist factions allied to Patricio Rivas, signed on 12 September, a "Providential Pact" declaring war against William Walker. For September 14, Septentrión Army (as the allied army was called) forces managed the first victory of the patriots Nicaraguans in the so-called Battle of San Jacinto.
By the end of 1856, Walker ordered the destruction of Granada.
The Costa Rican government resumed action in late 1856, and developed plans to take over the San Juan River in order to cut Walker's supply of weapons and new recruits. Cornelius Vanderbilt sent one of his agents, Sylvanus Spencer, to collaborate with the Costa Rican army in order to recover the possession of the Transit Company he had lost to Walker. Spencer arrives to San Jose in November 1856 and it is assigned to a company under Major Maximo Blanco to take over the steamers of the Transit Company. By January 1857, the Costa Rican army was in control of the San Juan River and all the steamers of the Transit Company.
Meanwhile, Walker was expelled from Granada by the rest of the allied armies. Some reinforcements under the command of Lockridge and Titus tried to recover the control of the River from the Costa Ricans, unsuccessfully. By April 1857, Walker had taken Rivas again, and the allies had laid siege to the city, in what became known as the Third Battle of Rivas.
On May 1, 1857, Walker surrendered to Commander Charles Henry Davis of the United States Navy and was repatriated. Upon disembarking in New York City, he was greeted as a hero, but he alienated public opinion when he blamed his defeat on the U.S. Navy.
, 1855June 29: First Battle of Rivas, 'Nicaraguan legitimista troops defeat Walker.
August 30: filibuster troops take port San Juan del Sur.
September 3: Battle of La Virgen, Walker victory over troops of Jose Santos Guardiola.
October 13: capture of the city of Granada by Nicaraguan democratic troops supported by filibusters.
, 1856March 20: Battle of Santa Rosa in Costa Rican territory.
April 11: Second Battle of Rivas: Costa Rican troops repels the attack . It highlights the soldier Juan Santamaría.
April 26: Costa Rican troops leave Nicaragua, decimated by cholera disease.
September 14: Victory of Nicaraguan patriots on filibusters in the Battle of San Jacinto (1856).
September 22: William Walker decrees legalizing slavery in the country.
November 7: Costa Rican troops under the command of José María Cañas occupy San Juan del Sur.
11 to 13 October: First Battle of Masaya: The Allied Central American Army repels the filibuster troops.
November 12: troops under William Walker defeated José María Cañas.
15 to 19 November: Second Battle of Masaya, American allies reject the troops of William Walker.
November 24 to December 14: destruction of Granada.
December 16: Walker took the city of Rivas.
December: Costa Rican troops began a series of attacks that take river steamers in San Juan del Norte and the river San Juan, and the fortress of El Castillo and San Carlos.
, 1857Jan. 3: Costa Rican troops take the steamer "San Carlos", isolating the government of William Walker by the Atlantic Ocean.
28 January: Allied troops occupy the lake port of St. George.
March 5: Nicaraguan and Central American troops under the command of Fernando Chamorro Alfaro and Florencio Xatruch respectively, defeat the filibusters in the Battle of The Jocote.
March 23: Third Battle of Rivas, Central American allies attack the village without results.
April 11: Fourth Battle of Rivas, Central American allies again attack the village without results.
April 17: Central American Allied troops occupy San Juan del Sur.
May 1: William Walker surrenders to U.S. Captain Charles H. Davis.
May 5: William Walker abandons Nicaragua.