On September 7, 1977, President Jimmy Carter and General Omar Torrijos Herrera signed two treaties in Washington that committed the United States to hand the Panama Canal over to Panama at noon on December 31, 1999. One treaty covered the transfer and the day-to-day running of the canal in the meantime. The other, on neutrality, gave the United States a permanent right to defend the waterway's neutrality, without a right to intervene in Panama's internal affairs.
The canal had been the central grievance of Panamanian politics since 1903, when it was created by a treaty signed by a French engineer, Philippe Bunau-Varilla, who held a power of attorney for the newly independent country and was acting in his own interest and Washington's. The Hay-Bunau-Varilla Treaty granted a canal zone ten miles wide in perpetuity. Riots over the flag flying there killed more than twenty people in January 1964. Negotiations began soon after.
What made the 1977 treaties possible was that both men had reasons to settle. Carter wanted to end a dispute that poisoned relations across Latin America and had become a standing argument in the Organization of American States. Torrijos needed sovereignty but had no way to force it, and the settlement gave him the canal without giving up the income or the American security guarantee in the short term. During the transition the zone was run jointly, with an increasing Panamanian share of the administration.
The fight was in the United States, not Panama. Ratification required 67 votes and the treaties got 68 on March 16, 1978, after months of campaigning in which opponents argued the canal was American property built with American money. Ronald Reagan used the issue in the 1980 primaries.
The handover happened on schedule. The canal has been run by the Panama Canal Authority since 1999, and traffic through it has more than doubled following the expansion opened in 2016, which added a third set of locks sized for the container ships that the original locks could not take. Torrijos never saw it. He was killed in a plane crash on July 31, 1981.