The Treaty of Madrid established boundaries between the United States and the Spanish colonies of Florida and Louisiana, and guaranteed navigation rights on the Mississippi River. In 1797, the United States signed a peace treaty with the Barbary state of Tripoli. However, this treaty was violated in 1801 by the Basha of Tripoli, which led to the Tripolitanian War. Also in 1797, the XYZ Affair erupted, with the humiliation of the United States government by French diplomats, leading to the threat of war with France, and ultimately the Quasi-War, an undeclared naval war from 1798 to 1800.