Like all of Central America, the native Indian population of Panama was all but destroyed by the disease and powerful weapons inflicted on them by the Spanish during their aggressive colonization.
As the Spanish regional power increased, Panama became the launching point for invasions into South America. Most of the treasure mined (stolen) by the conquistadors in Bolivia and Peru was sent back to Panama for transport to Spain.
Treasures shipped across the Caribbean became a strong magnet (an easy mark) for pirates (and over time) to reduce their increasing losses, the Spanish Crown decided to transport the gold and silver south, around the southern tip of South America, on a long (but safe) journey back to Spain.
With little strategic value remaining for Spain, Panama was ignored. When neighboring Colombia gained its independence from Spain in 1821, Panama became a province of that new country.
With U.S. backing, Panama seceded from Colombia in 1903, and promptly signed a treaty with the U.S. allowing for the construction of a canal and U.S. sovereignty over a strip of land on either side, to be called the Panama Canal Zone.
Ignoring the tragic attempt by the French to build the canal in the late 19th century, the U.S. Army Corps of Engineers successfully constructed it between 1904 and 1914, a feat that revolutionized ocean-going shipping, even to the present day.
Understandable unhappiness by Panama on its major asset about being controlled by a foreign land, an agreement was signed in 1977, calling for the complete transfer of the Canal from the U.S. to Panama by the end of 1999.
In the mid-1980s General Manuel Noriega took control of Panama, and during his messy 5-year dictatorship, democracy disappeared, the economy was severely damaged, drug trafficking from South America increased, and the population lived in fear of further repression.
With U.S. help, Noriega was deposed in 1989. The entire Panama Canal, the area supporting the Canal, and remaining U.S. military bases were turned over to Panama on December 31, 1999.