The 1850s California Gold Rush created interest in the United States in finding a quicker route between the American east and west coasts.
[10] To circumvent American neutrality laws, Walker obtained a contract from Democratic president Francisco Castellón to bring as many as three hundred "colonists" to Nicaragua.
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.
He was inaugurated on 12 July 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.
Also, democratic and loyalist factions allied to Patricio Rivas, signed on 12 September, a "Providential Pact" declaring war against William Walker.
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.
[citation needed] The final battle of what Nicaraguans called the "National War" (1856–1857) took place in the spring of 1857 in the town of Rivas, Nicaragua.
Walker attempted to return to campaign in the region in 1860, but he was arrested by the Royal Navy when he disembarked at Trujillo, Honduras, tried for piracy by a Honduran military court, and executed.