For hundreds of years, visionaries had dreamed of building a canal across the isthmus. Even the early Spanish colonists toyed with the idea until King Philip II allegedly declared that if God had wanted a canal joining the oceans, God would have put one there himself.
The French were the first to undertake the challenge, in 1882. The moving force behind the effort was Ferdinand de Lesseps, a charismatic diplomat with no engineering background who was basking in the glory of leading the successful effort to build the Suez Canal. He insisted that building a sea-level canal at Panama would be far easier. After all, Suez was twice as long.
But this was Panama , and a sea-level canal here meant digging through mountains, not sand, and contending with its tropical diseases, fierce heat, torrential rains, and forbidding terrain.
The French failed disastrously. It has been estimated that 20,000 workers died, mostly of disease, during the seven-year French effort. The French canal company ran out of money in 1889, and the ensuing financial crisis nearly bankrupted France.
The United States had long toyed with building its own canal. It bought out the French concession, but clashed with the government of Nueva Granada (i.e., Colombia) over payments and the granting of rights over the proposed waterway. When negotiations stalled, the United States, under President Theodore Roosevelt, decided to support a small independence movement in Panama spearheaded by a few prominent Panamanians and Panama Railroad officials. In a display of literal “gunboat diplomacy,” America sent a warship to Panama to intimidate the Colombian forces on the isthmus. On November 3, 1903, Panama declared its independence from Nueva Granada.
It was a remarkably peaceful civil war. Bloodshed was likely averted by a fast-thinking Panama Railroad official. He convinced a Colombian general who had just landed with his troops in Colón that it was only fitting that he and his officers should ride in a special train car ahead of his men, who were left stranded in Colón. When the officers arrived in Panama City , Panama-based Colombian soldiers who had been bought off by the revolutionaries took them prisoner. The only casualty during the whole conflict was a Chinese shopkeeper, asleep in his bed, who was killed by an errant shell from a Colombian gunboat. A second shell killed a donkey in a slaughterhouse. By November 6, the revolution was over.
The United States immediately signed the controversial Hay–Bunau-Varilla Treaty with the new Panamanian government, which gave America the right to build a canal in Panama. It would become a source of contention for decades to come that no Panamanian signed the treaty. The official signatory for Panama was a Frenchman, Philippe Bunau-Varilla, the former director of and major shareholder in the French canal effort. The revolutionaries had reluctantly agreed to let him negotiate with Washington on their behalf as an “envoy extraordinary.” He signed the treaty in New York before the Panamanian delegation even arrived.
The treaty granted the United States control “in perpetuity” over the canal and a 50-by-10-mile strip of land surrounding it. The United States paid the new country of Panama US$10 million, plus an annual payment of US$250,000. The French canal company received US$40 million for all the equipment, infrastructure, and excavation it left behind, much of which proved useful to the Americans.
The American effort was quite different from the French one. Instead of a sea-level ditch, the U.S. plan called for a lock canal that would lift ships over the isthmian landmass. The plan was designed by John Stevens, a brilliant railway engineer, and seen to completion by his successor as chief engineer, George W. Goethals. All work on the canal had to be halted, however, until disease could be controlled. Under the leadership of a forward-looking sanitary officer named Dr. William Gorgas, the Americans eliminated yellow fever from Panama, brought malaria and other deadly diseases under control, and introduced clean water and modern sanitation to the isthmus.
The canal was a colossal task. It required an excavation three times as massive as that at Suez. And among other challenges, the builders had to cut right through nine miles of mountains at the Continental Divide, a job overseen by David Gaillard, for whom the resulting Gaillard Cut  is named. The lock chambers were among the largest structures ever made by humans. The mighty Río Chagres  was contained by the largest earthen dam in history, forming the largest artificially-made lake in the world. The canal is still considered one of the most extraordinary engineering feats of all time.
The U.S. canal effort cost US$352 million and took 5,600 lives, most of them West Indians who made up the bulk of the labor force. But the canal opened for business on August 15, 1914, under budget and ahead of schedule.