The Campaign of 1856–1857 was when Costa Rica defeated the army of the American filibuster William Walker.
Initial Stages 
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 Walker who, to circumvent U.S. 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.
Fall of Nicaragua 
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.
Costa Rican Counterattack 
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. Vanderbilt financed and trained a military coalition of these states, led by Costa Rica, and worked to prevent men and supplies from reaching Walker. He also provided defectors from Walker's army with payments and free passage back to the U.S. In April 1856, Costa Rican troops and American mercenaries supported by Vanderbilt 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, played a key role. 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, declaring English an official language and reorganizing currency and fiscal policy to encourage immigration from the United States. Walker's army had though been weakened by an epidemic of cholera and massive defections, it was no match for the Central American coalition.
Walker's Surrender 
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.
See also