Owing to its geographical remoteness, local authorities in what is today Argentina developed an early sense of autonomy. Based largely on economic needs, during colonial times their pragmatism led to a flourishing unofficial market in smuggled goods, out of the then-small port of Buenos Aires, in blatant contravention of the Spanish mercantilist laws. With the Enlightened despotism of the late-eighteenth-century Bourbon kings and the creation of the Viceroyalty of the Ro de la Plata in 1776, trade increased as the political importance of the port-city of Buenos Aires soared. The urgency for a complete liberalization of commerce remained a powerful political cause for Criollos and Mestizos, further stimulated by the politically egalitarian and revolutionary ideals spread by the French and Anglo-American revolutions. Ultimately, the actual experience of successfully defending without Spanish aid the viceroyalty from a foreign invader during the 18061807 British invasions of the Ro de la Plata, triggered a decisive quest for even greater autonomy from the colonial metropolis.
Between 1808 and 1810, the Napoleonic French Empire openly invaded Spain, after deposing King Ferdinand VII and taking him prisoner. A Spanish resistance formed an emergency government, the Supreme Central and Governing Junta of the Kingdom in order to govern themselves and the Spanish Empire in the absence of Ferdinand VII. But, when the Supreme Central Junta dissolved itself on 29 January 1810, under extreme pressure from Napoleonic forces, most of the main cities of Spanish America refused to acknowledge its successor, a Regency Council, as the legitimate depositary of sovereignty. They proceed to name their own local juntas, as a means to exercise government in the absence of the prisoner king.
On May 25, 1810, a Criollo-led cabildo abierto formally assumed the authority from Viceroy Baltasar Hidalgo de Cisneros. However, the ensuing United Provinces of South America (formed on the basis of the former Viceroyalty) declared itself independent on 9 July 1816, after Ferdinand VII was restored in 1815. During the Independence Wars no sovereign state recognized the United Provinces.
Until the fall of the Royalist stronghold of Lima in 1821, and the Battle of Ayacucho of 1824, territorial integrity was solely sustained by the military brilliance of Generals Jos de San Martn and Manuel Belgrano, the continuous efforts of northern provinces defenders Martn Miguel de Gemes and Juana Azurduy, among many others. However, during this same period, internecine power conflicts among diverse leaders, and ideological and economical struggles developed between Buenos Aires Province and much of the rest of the United Provinces, with many of the Provinces bonding themselves into a Federal League, inspired by Federalist Jos Gervasio Artigas' leadership. In practice, each side treated the other's grievances as a "foreign policy" matter.
The Unitarian Constitution of 1819 was immediately rejected by the provinces, and a state of anarchy ensued following the Battle of Cepeda. The only cause that could regain unity among the hostile factions was the 1825 invasion of what today is Uruguay on the part of Brazilian Empire. Uruguay, then known as the Province of the Eastern Bank of the Uruguay River, was considered a somewhat breakaway Province, since Montevideo served as the seat of the Royalist Viceroy Francisco Javier de Elo during its war on the May Revolution; and that, after the independentists victory, the Province became the main stronghold of the Federal League leader Jos Gervasio Artigas, who waged a long and bitter dispute during the 1810s against the Unitarians about the shape the national organization would have.
The war crisis led to a new Constitution and a first semblance of a united national government, at the same time it represented the first foreign policy crisis of the young nation (known as Repblica Argentina, per the 1926 Constitution), as it forced the nation into war with Brazil.
The common cause the crisis provided did lead to enough institutional stability to have the British Empire recognize Argentina (as President James Monroe had the U.S. State Department done in 1822) and led to the election of the first President of Argentina. The opportunity for unity, however, was wasted largely because the new President, Bernardino Rivadavia, pushed a new Constitution even more biased towards Buenos Aires' agenda than the failed 1819 document. The war with Brazil, moreover, went badly. Land battles were won, early on, and despite some heroic feats on the part on Irish-born Admiral Guillermo Brown, the war dragged on, resulting in bankruptcy. This and the hated new constitution led to the end of the first republic by 1828; it also led, however, to peace with Brazil and the formation of an independent Uruguay.
26 September 1828 treaty itself became another foreign policy crisis, as it triggered a violent coup d'tat by generals opposed to what they saw as a unilateral surrender. The murder of the man responsible for the treaty, Buenos Aires Governor Manuel Dorrego, itself led to a countercoup that brought with it the promise of a lasting peace; but eventually led to destabilizing consequences.
The countercoup brought in a new governor for the Buenos Aires Province, who would in time become the leading figure of a loose confederation of Argentine Provinces (the so-called Argentine Confederation). Juan Manuel de Rosas made it his mission to stabilize Argentina in a confederacy under the tutelage of Buenos Aires Province. This led to repression, massacres of Native Americans in the Pampas and, in 1838, an international embargo over the case of a French journalist tortured to death at Rosas' orders. An unyielding Rosas might have let the impasse continue for a decade or more; but, Admiral Guillermo Brown made his talents amenable once again, forcing the French blockade to be lifted in 1841.
Having come to power avenging the murder of a man who had decided to cease interference in Uruguay, Rosas invaded Uruguay upon the 1842 election of a government there antagonistic to his personal commercial interests (mainly centered in the export of cow hides and beef jerky, valuable commodities in those days). Commercially close with the French and British Empires, Uruguay's crisis met with swift reprisals against Rosas and the Argentine Confederacy from the two mighty powers. Slapped with fresh embargoes and a joint blockade, Argentina by 1851 found itself bankrupt and with "rogue nation" standing; on 3 February 1852, a surprise military campaign led by the Governor of Entre Ros Province, Justo Jos de Urquiza, put an end to the Rosas regime and, until 1878, at least, serious Argentine foreign policy misadventures.