The Madeira-Mamoré Railway, built between 1907 and 1912, runs for 364 km through the Amazon rainforest, connecting the cities of Porto Velho and Guajará-Mirim. The railway was constructed under the Petrópolis Treaty of 1903, in which Bolivia transferred the territory of Acre (191,000 km²) to Brazil in exchange for financial compensation, land, and a promise to build the railway to bypass the dangerous rapids of the Rio Madeira. Some accounts suggest that Brazil paid 2 million pounds sterling for this agreement. The railway was built by the Madeira-Mamoré Railway Co., a company led by American entrepreneur Percival Farquhar, who oversaw the project from its start in 1907 until its completion in 1912. The construction employed approximately 30,000 workers from various nationalities, including Greeks, Spaniards, Italians, Germans, indigenous peoples of the region, and Brazilians. Although the railway was officially completed at 364 km, some sources claim that up to 366 km of track was built and used. However, its usefulness was short-lived. In 1912, the global latex market collapsed as Asian plantations became more competitive, rendering the railway obsolete almost immediately. Brazilian historical records state that the railway was completed on August 1, 1912, and officially inaugurated on September 7 of the same year. However, English sources mention alternative dates, such as April 30 and July 15, which suggests that the timeline of the project remains uncertain. By 1913, the Farquhar company had gone bankrupt and was placed under administrative control. The opening of the Panama Canal in 1914 further reduced the need for the railway, and the construction of a railway connecting Bolivia to the Pacific through Chile added yet another blow to its viability. Some sources claim that the railway operated at full capacity for only one year. Brazil continued to maintain the railway at a financial loss to fulfill its treaty obligations. In the 1930s, it came under the control of the Brazilian government and was used primarily to transport people, food, and to support agricultural colonies along the border, including the Iata colony in Guajará-Mirim. The railway was officially decommissioned in 1966 under President Castelo Branco, with the last train running in 1972. A road network, BR-364/BR-425, was built to replace the railway and ensure the treaty was honored. The railway’s equipment was gradually dismantled starting in 1979. Today, parts of the original railway route have been incorporated into the BR-364 highway, which has taken over some of the old railway structures. In 2006, the remaining sections of the railway were designated as Brazilian cultural heritage in a summary of the country’s railway history. The Madeira-Mamoré Railway is often referred to as "The Railway of the Devil," a nickname rooted in the extreme hardships faced during its construction. Workers endured malaria, accidents, and violence, with 1,522 deaths recorded at the only hospital in Candelária. This number is considered a minimum, as estimates suggest that up to 6,000 people may have died during the project. The legend of "one death per rail" is widely circulated, though other versions suggest one death per 100 rails, highlighting the lack of precise records. Historians note that part of this legend may be linked to the failures of George Earl Church, who attempted to build the railway in the 1870s but was hindered by diseases and other challenges.