Reading up on the Louisiana Purchase led me to this passage on Wikipedia:
How might this have led to war?Following the establishment of the United States, the Americans controlled the area east of the Mississippi and north of New Orleans. The main issue for the Americans was free transit of the Mississippi to the sea. As the lands were being gradually settled by American migrants, many Americans, including Jefferson, assumed that the territory would be acquired "piece by piece." The risk of another power taking it from a weakened Spain made a "profound reconsideration" of this policy necessary.[4] New Orleans was already important for shipping agricultural goods to and from the areas of the United States west of the Appalachian Mountains. Pinckney's Treaty, signed with Spain on October 27, 1795, gave American merchants "right of deposit" in New Orleans, granting them use of the port to store goods for export. The treaty also recognized American rights to navigate the entire Mississippi, which had become vital to the growing trade of the western territories.
In 1798, Spain revoked the treaty allowing American use of New Orleans, greatly upsetting Americans. In 1801, Spanish Governor Don Juan Manuel de Salcedo took over from the Marquess of Casa Calvo, and restored the American right to deposit goods. However, in 1800 Spain had ceded the Louisiana territory back to France as part of Napoleon's secret Third Treaty of San Ildefonso.[6] The territory nominally remained under Spanish control, until a transfer of power to France on November 30, 1803, just three weeks before the formal cession of the territory to the United States on December 20, 1803.