The canal treaty granted the United States rights in perpetuity over land on both sides of the canal and a broad right of intervention in Panamanian affairs. The treaty led to friction between the two countries for decades. The United States began to build the canal again in 1904, and 10 years later the first ship negotiated the engineering marvel. The US intervened in Panama's affairs repeatedly up until 1936, when it relinquished its right to use troops outside the Canal Zone. A new treaty was signed in 1977. Panama formally regained control of the canal in 1999.
In 1984, General Manuel Noriega took control of the country. A former head of Panama's secret police and a CIA operative, Noriega became a demagogic bogeyman, murdering political opponents, squashing democracy, trafficking drugs and laundering money. When the winning candidate of the 1989 presidential election was beaten to a pulp on national TV and the election declared null and void, Noriega's regime became an international embarrassment. Noriega appointed himself head of government and announced that Panama was at war with the USA. The following day an unarmed US soldier dressed in civilian clothes was killed by Panamanian soldiers; the Panamanians claimed that he was armed and had shot and injured three civilians before running a roadblock.
The US called in 26,000 troops for 'Operation Just Cause', which was intended to bring Noriega to justice and create a democracy better suited to US interests; it left more than 2000 civilians dead and thousands homeless. Noriega escaped capture by claiming asylum in the Vatican embassy; he was captured a few days later, sent to the US and convicted of money laundering.
The legitimate winner of the 1989 presidential election, Guillermo Endara, was sworn in as president. In 1994 Ernesto Pérez Balladares took office. Under his direction, the government implemented a program of privatization and focused on infrastructure improvements, health care and education. In 1999 Mireya Moscoso, Panama's first female leader and head of the conservative Arnulfista Party (PA), took office.
In 2000 Moscoso set up an investigation of state crimes committed between 1968 and 1989 and in 2002 set up another investigation, this time looking into government graft. She nevertheless lost the presidential election in May 2004, and was replaced by Martin Torrijos.
In October 2006, Panamanians voted in a referendum to expand the Panama Canal. The ambitious job-creating project started in September 2007, and will see the canal's system of channels and locks widened and improved to make it suitable for modern supertankers and to cut waiting times. The hefty multi-billion dollar construction bill is expected to be funded by an increase in canal tolls and foreign investment.