Costa Rican railroad
In 1871, Keith's uncle Henry Meiggs had signed a contract with the government of Costa Rican president Tomás Guardia Gutiérrez for the construction of a railroad from the capital city of San José to what was to become the Caribbean port of Limón. Minor Keith was involved in the project from the start and took it over after Meiggs's death in 1877.
At the time, Costa Rica's economy was based primarily on the export of coffee, which was grown in the country's central valley and transported by oxcart to the Pacific port of Puntarenas. Since the main market for Costa Rican coffee was in Europe and no canal connecting the Pacific and the Atlantic existed, creating a reliable transportation route to the Caribbean was a priority for the Costa Rican government and business class.
The construction of that railroad proved extraordinarily challenging due to inadequate financing, compounded by the rugged terrain, thick jungle, torrential rains, and prevalence of malaria, yellow fever, dysentery, and other tropical diseases. As many as four thousand people, including Keith's three brothers, died during the construction of the first 25 miles of track, mostly from malaria. Keith was forced to hire foreign laborers, including black workers from Jamaica, as well as some Chinese and even Italians. The Jamaicans that Keith brought in were English speakers and to this day maintain their heritage.
By 1882, the Costa Rican government had defaulted on its payments to Keith and could no longer meet its obligations to the London banks from which it had borrowed to pay for the railroad. Keith managed to raise £1.2 million himself from the banks and from private investors. He also negotiated a substantial reduction of the interest on the money previously lent to Costa Rica, from 7% to 2.5%. In exchange, the government of President Próspero Fernández Oreamuno gave Keith 800,000 acres (324,000 hectares) of tax-free land along the railroad, plus a 99-year lease on the operation of the train route. These terms were made official in a document signed by Keith and cabinet minister Bernardo Soto Alfaro on April 21, 1884 (known to Costa Rican historians as the "Soto-Keith contract"). That land grant corresponded to about 6% of the total territory of Costa Rica.
The two most powerful cabinet ministers in the government of President Fernández were his son-in-law Soto (who succeeded him after his death) and his brother-in-law José María Castro Madriz, who had previously served as President of Costa Rica on two occasions. In 1883 Minor Keith married Cristina Castro Fernández, who was the daughter of Castro Madriz and niece of President Fernández, as well as the cousin-in-law of Soto. Keith's nephew-in-law Rafael Iglesias Castro would serve two consecutive terms as President of Costa Rica, from 1894 to 1902.