President Trump wants Panama to return its namesake canal to the U.S.

Panama’s birth as a nation is directly linked to the U.S.’s coming of age as a young imperial power after its victory in the Spanish-American War of 1898. In the age of gunboat diplomacy with former Rough Rider Theodore Roosevelt as president, the U.S. engineered Panama’s secession from Colombia in 1903. Aiming to project naval power, Washington embarked on what became the construction marvel of the early 20th century: linking the Atlantic and Pacific Oceans through a canal across Panama’s deadly tropical forests.

Panamanian grievances over the U.S. presence led President Jimmy Carter in 1977 to sign treaties handing over the waterway and requiring a neutrality that guaranteed the peaceful passage of ships from all nations. The pacts were approved by the U.S. Senate despite vociferous opposition by conservatives. Trump’s push to grab back power over the waterway is the latest twist in the canal’s nearly 150-year saga.

On Tuesday, Panama submitted a complaint to United Nations Secretary-General António Guterres over Trump’s remarks, citing a breach of the U.N. charter requiring member states to refrain from threats or use of force against the territorial integrity or political independence of nations.

Panama Canal

U.S. President Theodore Roosevelt tests a steam shovel at the Culebra Cut during construction of the Panama Canal, a project he championed, November 1906. Roosevelt’s visit to Panama made him the first sitting U.S. president to travel abroad. (AP Photo)

Early failures

As far back as 1534, the Spanish crown ordered the first study for a canal route across the 40-mile isthmus between the Atlantic and the Pacific for the transport of gold and silver from Peru to Spain.

The Panama Canal’s initial construction project began in 1880, led by celebrated French diplomat and developer Ferdinand de Lesseps, flush from his triumph building the flat, seawater Suez Canal in Egypt. But the lush jungle and mountainous terrain proved insurmountable obstacles, pushing the project into insolvency. De Lesseps was convicted of mismanagement and fraud. France’s failure resulted in the deaths of about 20,000 workers, most of them Caribbean laborers who were exposed to malaria and yellow fever spread by mosquitoes.

Before the French attempt, a U.S. company had already built a railroad linking the two oceans to help thousands of Americans seeking to join the California Gold Rush from the U.S. East Coast in the mid-19th century. The Panama Railroad opened for business in 1855.

The construction

In 1903, the U.S. pushed for the independence of Panama, then a province of Colombia, in a prelude to the American canal venture. The next year, the U.S. took over the project and some of France’s abandoned machinery. Unlike Suez, the Panama Canal was to rely on a complex system of locks to lift ships almost 90 feet above sea level and lower them at the other end, using fresh water from a man-made lake.

More than 5,600 people died during a construction project that took a decade, including about 350 Americans. About 45,000 people worked on the project until its completion in 1914, with two-thirds coming from Caribbean islands such as Barbados and Martinique. Some 12,000 were European, mostly Spaniards. Most senior management, engineers and other skilled professionals were Americans.

Controversy builds

The engineering marvel of the day opened for business in 1914. It was built at a cost of $375 million, then the most expensive American engineering project ever.

The U.S. was granted control over the Panama Canal Zone, an area roughly 10 miles wide along the entirety of the canal’s 50-mile length. Many Panamanians saw the 553-square-mile enclave that bisected the tiny Central American nation, and its residents, known as “Zonians,” as part of a U.S. colonial occupation. Crowded with nearly two dozen military bases and installations, the zone boasted tidy homes with red tile roofs and manicured lawns, as well as shops, golf courses, a yacht club, American Legion posts and churches. It was run by a governor appointed by the U.S. president who was supervised by the secretary of the Army.

In January 1964, 21 Panamanians were killed by U.S. forces during riots sparked by a group of high-school students wanting to plant Panama’s flag in the Canal Zone. Panama’s President Roberto Chiari spoke with President Lyndon B. Johnson and briefly cut diplomatic ties with the U.S. The deaths are commemorated annually with Panamanian flags flown at half mast in observance of Martyrs’ Day, a national holiday.

The treaty

The 1964 riots shook the country and fueled Panama’s drive to gain control of the canal. In 1977, President Jimmy Carter signed two treaties committing the U.S. to hand over the waterway and surrounding Canal Zone.

Panama Canal

FILE PHOTO: U.S. President Jimmy Carter at the White House during a fireside chat on the Panama Canal Treaty at the White House, in Washington, U.S. February 1, 1978. Library of Congress/Marion S. Trikosko/Handout via REUTERS/File Photo THIS IMAGE HAS BEEN SUPPLIED BY A THIRD PARTY.

One treaty said the Panama Canal Zone would cease to exist on Oct. 1, 1979, and the canal would be turned over to Panama on Dec. 31, 1999. A second treaty gave the U.S. the right to intervene militarily to defend the waterway against any threat to its neutrality.

The invasion

Trump’s vow to take back the canal, and refusal to rule out military action to do so, has upset Panamanians. Most remember the 1989 U.S. invasion in which more than 500 Panamanians and 23 U.S. soldiers were killed. The operation deposed the country’s strongman, Gen. Manuel Noriega, after the U.S. indicted him for drug trafficking and he annulled presidential elections won by an opposition candidate.

The U.S. invasion wasn’t triggered by the canal, which was then being transferred to Panama, although Noriega tried to make it an issue. He took refuge for 10 days at the Vatican’s Embassy as U.S. troops blasted earsplitting rock music in a bid to force him out. He surrendered to U.S. forces and was flown to Miami where he was tried and convicted. After years in prison, Noriega was returned to Panama, where he died in 2017.

Panama takes control

When the U.S. transferred the canal to Panama in 1999, the waterway’s original locks from 1914 were almost obsolete as they were too narrow for many U.S. Navy ships. Panama embarked on an overhaul to expand canal capacity and boost profitability.

It invested more than $5 billion to build larger locks that boosted revenue and the number of ship passages to as many as 36 a day. That sparked its transformation into a vital link for global trade that also triggered investment at U.S. ports to handle the larger tankers going from one coast to the other with oil and liquefied natural gas. The canal now generates some $5 billion in annual revenue. The government keeps about half and the rest covers operating costs and investments.

Trump steps in

After he was elected, Trump startled Panamanians in late December when he said the U.S. should take back the canal, without ruling out military force if necessary. He said the canal is controlled by China and that U.S. ships are overcharged. Panama’s pro-American president, José Raúl Mulino , said Panama would never return the waterway. “Every square meter of the Panama Canal and its adjacent area belongs to Panama and will continue to be so,” said Mulino, who took office in July. Hong Kong-based Hutchison Whampoa, which operates two container terminals on each side of the canal, has no control over the waterway, Panamanian officials say. A vessel’s size, type and cargo determine prices, not its flag.

John Feeley , Trump’s former ambassador to Panama, said the president’s obsession with the canal stems from his long-held belief shared by many conservatives that returning the canal to Panama was a bad idea. Trump was angered when in 2017 Feeley told the president that U.S. Navy ships paid fees to transit the waterway. Panamanian authorities say U.S. Navy vessels get passage priority. “We should not pay a dime,” Feeley said Trump replied. “We built it and Carter did a bad deal.”

The U.S. Navy has paid the canal just $25.4 million in the past 26 years, or less than a million dollars a year, according to the Panama Canal Authority. “It’s budget dust,” said Feeley, calling it an insignificant sum in a Defense Department budget that is nearly $900 billion this year.

Write to José de Córdoba at jose.decordoba@wsj.com and Santiago Pérez at santiago.perez@wsj.com