# History of Spain (1700–1808)

The Kingdom of Spain (Spanish: Reino de España) entered a new era with the death of Charles II, the last Spanish Habsburg monarch, who died childless in 1700. The War of the Spanish Succession was fought between proponents of a Bourbon prince, Philip of Anjou, and the Austrian Habsburg claimant, Archduke Charles. After the wars were ended with the Peace of Utrecht, Philip V's rule began in 1715, although he had to renounce his place in the succession of the French throne.
Spain entered a period of reform. Ideas of the Age of Enlightenment entered Spain and Spanish America during the eighteenth century. The invasion of the Iberian Peninsula by Napoleon Bonaparte in the Peninsular War upended the stability of the Spanish state and empire and although France was defeated, the turmoil in Spain led to the Spanish American wars of independence of 1808 to 1833.
The 18th century in Spanish historiography is often referred to as Bourbon Spain, but the Spanish Bourbons continued to reign from 1814 to 1868 (following the restoration of Ferdinand VII), from 1874 to 1931, and since 1975.

## Philip V, first Spanish Bourbon monarch (1700–1724, 1724–1746) and Louis I (1724–1724)
### War of the Spanish Succession

The last few years of the rule of the mentally challenged and childless Spanish Habsburg Charles II, were dominated by the politics of who would succeed the unfortunate monarch, the last Spanish king of the Habsburg dynasty. Spain was at the center of this political crisis, but it was the "object not the arbiter." Economic troubles, the decay of the Spanish bureaucracy, a series of defeats in wars against France, and the erosion of imperial institutions in the seventeenth century had left Charles the king of a declining empire, and his physical and mental weakness provided him with little ability to reverse the course of his country. The vastness and wealth of the ultramarine Spanish Empire in the New World and the Philippines, along with her naval resources, had made Spain a vital part of European power politics. If the throne of Spain was to go to a relative of the king of France, or if the two countries were to be united, the balance of power in Europe would shift in France's favor. The wealth of the Spanish overseas empire would flow to France. If it remained in the hands of another member of the anti-French, Austrian Habsburg dynasty, the status quo would remain. European politics at the end of the 17th century became dominated by establishing an orderly succession in Spain that would not alter the balance between Europe's great powers.
Bourbon France and Habsburg Austria and its allies went to war to determine the successor to Charles. The prize was the wealth of the Spanish Empire. The War of the Spanish Succession (1702–14) was won by France, but by the Treaty of Utrecht that ended the conflict, the French and Spanish Bourbon dynasties pledged not to unite formally. Louis XIV of France's exclamation that the "Now there are no more Pyrenees!", after his grandson became Spain's monarch, did not come to pass. Although Charles II's chosen heir inaugurated a new dynastic house in Spain, the Habsburg Spanish empire in Europe was reduced to the Iberian peninsula itself, with the loss of the Spanish possessions in Italy (the Duchy of Milan, Kingdom of Sicily, Kingdom of Naples, and Kingdom of Sardinia) and the Spanish Netherlands, and Britain captured Gibraltar and the island of Menorca as well. The Treaty of Utrecht ended the conflict and Philip V of Spain renounced any claims to the French throne. Before the conflict ended, Philip's young wife, Maria Louisa of Savoy (1688–1714) died, but the Bourbon royal succession was assured with the birth of two sons.

### Changes in government under Philip

Philip V proved an effective administrator, centralizing the Spanish authority by eliminating regional cortes (parliaments) and beginning a process of making uniform the laws among the various regions of Spain's empire by eliminating special privileges (fueros). The Nueva Planta decrees (1716) dismantled the composite system of rule in Spain, and replaced it with rule from Madrid and unitary Castilian values. If the Austrian Habsburgs had won the War of the Spanish Succession, Habsburg pluralism promised to be continued, leading Aragon to support the losing Habsburg cause. The Nueva Planta decrees eliminated that regional autonomy. "The most enduring achievement of the reign of Philip V was to establish, for the first time since the Romans, a single, united polity."
Also eliminated with the Bourbon dynasty was the Habsburg system of conciliar government, replacing councils with four secretariats, later evolving into ministries: State & Foreign Affairs, Charity & Justice; Army & Navy, and The Indies, i.e., the overseas portions of the Spanish Empire. The four ministers formed a "cabinet council" and ministers were directly responsible to the crown. In general, aristocratic men no longer dominated government positions, but rather men of talent who were then elevated to high position and rewarded with noble titles. Some 200 new titles were created by Philip alone. Administrative reforms included the division of Spain into eight reinos (lit. 'kingdoms') headed by a military official and an audiencia was established for the administration of justice. Local level administrators (corregidores), which had already existed in Castile, were appointed to the other reinos. An important reform was in taxation and royal debt. Some bonds issued by the crown were repudiated while others had their interest rate downgraded. New tax officials were efficient in collecting and administering taxes, to the benefit of the new monarchy. Regions that had not paid taxes at the same levels as Castile were not subject to taxation by the unitary state. Since Spain under the Bourbon monarchs pursued many wars, having a tax base to pay for them was crucial.
Philip's selection of capable French and Italian ministers to key positions in the government reined in independent, isolated, and corrupt ministries that had flourished in the later period of Habsburg rule. Philip aimed at expanding economic activity and moved toward economic freedom, especially regarding Spain's trade in its overseas empire, in theory a Spanish monopoly. Expanding Spanish manufactures and agricultural exports was envisioned, so that trade did not benefit foreign powers who had horned in on the Spanish American trade. The House of Trade, long operating in Seville, was moved to Cádiz in 1717, while the monopoly on trade with the Spanish Empire was also opened to all the ports of peninsular Spain. Philip permitted the foundation of the Basque Caracas Company in 1728, on the model of Northern European trading companies, to trade with Venezuela, a major producer of chocolate. The free trade zone (comercio libre) within the Spanish sphere expanded further with later Spanish Bourbons.

### Military conflicts

Philip was often dominated in his policies by his second wife, Elizabeth Farnese. He adopted an aggressive foreign policy that involved Spain in a series of costly wars throughout his reign. The loss of so much of the European territory promised to him by Charles II's will and Philip V's personal ambition put him at unease with the Treaty of Utrecht. Philip's wife Elizabeth, a member of the ducal house of Parma, and her favorite minister, Cardinal Giulio Alberoni, desired to have their claims in Italy and those of Philip restored. But an alliance of France, Britain, and the Dutch Republic challenged Spain's ambitions, which threatened the peace of Europe. In 1717, Philip invaded Sardinia, one of the territories lost to Austria after the War of the Spanish Succession. The invasion of Sicily thereafter prompted the formation of the Quadruple Alliance of Britain, France, Austria, and the Dutch to oppose Philip's ambitions. In 1720, embarrassed by the failure of Spanish arms at sea and on land in the War of the Quadruple Alliance, Philip dismissed Alberoni and signed a peace treaty with Austria, with both sides recognizing the Treaty of Utrecht.
The Spanish again attempted to regain some of their lost territory in the Anglo-Spanish War (1727–1729). An alliance was concluded in 1725 with the Austrians, who agreed to help the Spanish in retaking key naval bases in the Mediterranean—Menorca and Gibraltar—from the British.
In response, an alliance was forged by the British Secretary of State, Charles Townshend, 2nd Viscount Townshend, with France and the Dutch Republic; when Philip did finally lay siege to Gibraltar, Austria declined to intervene against the powerful alliance, and Spain was left alone once again. French armies invaded the Basque Country and Britain and Netherlands elected to capture Spain's New World empire and disrupt precious metal shipments, hoping to prevent Philip from buying the Austrians into intervention; the allies suffered greater losses in men than the Spanish but the plan succeeded and Philip was forced to sue for peace in 1729. Elizabeth Farnese did get one of her wishes, though; securing the succession rights in the Duchy of Parma and Piacenza and Grand Duchy of Tuscany.
After 1729, Philip was more reserved in his use of Spanish power and sought the close support of allies, in particular France: a more cautious strategy that yielded positive results. Philip sought a friendly axis with his relatives in France in the War of the Polish Succession, where he succeeded in regaining the kingdoms of Naples and Sicily for his son, the future Charles III of Spain. The Pacte de Famille with Louis XV of France was signed in 1733, bringing the two states closer together after the embarrassments of the Quadruple Alliance. Friction with Britain prompted by the War of Jenkins' Ear (1739–1741) pushed Philip into a closer alliance with France in the years leading to the War of the Austrian Succession, in which Philip obtained the Duchy of Parma and Duchy of Guastalla from Austria for his son Philip. This restored Spanish power in Italy to much of its pre-1700 extent and added new territories, albeit to a more indirect degree.

### First Minister Ensenada

Late in his reign, Philip elected to place the reformation of his government in the hands of his ministers. The youthful and ambitious Zenón de Somodevilla had been created Marquess of Ensenada in 1736 for his successful diplomacy after the War of the Polish Succession, and seven years afterwards, in 1743, he was made Philip (and Elizabeth's) favorite at court, and for the remainder of Philip's reign, Ensenada effectively ruled Spain. Ensenada sought a cautious but independent foreign policy that distanced his country from both France or Britain, and desired a stable, peaceful environment in which Spain could reform her institutions. Ensenada commissioned a secret report on the state of Spanish America carried out by Jorge Juan and Antonio de Ulloa. Their report asserted that the overseas empire was inefficiently and incompetently administered by American-born Spaniards (criollos) and detailed the enmity between peninsular-born Spaniards and American-born colonials. Administrative reforms of the overseas empire was informed by the report Ensenada commissioned.

## Ferdinand VI (1746–1759)

The end of the War of the Austrian Succession had awarded Ensenada a victory that cemented his support in Spain. However, two years before the war ended, King Philip, his strongest supporter, died, and was succeeded by his son Ferdinand VI. Ferdinand was Philip's son by his first marriage to Maria Luisa of Savoy; he had suffered under the domineering influence of his stepmother as a child, and as king, he was constantly unsure of his own abilities. Elizabeth Farnese, the queen who had effectively controlled Philip V, left the court on her husband's death. Like his father, Ferdinand was extremely devoted to his wife, Barbara of Portugal and she dictated much of his policy and political decisions; at the time of Ferdinand's coronation in 1746, it was said that "Queen Barbara has succeeded Queen Elizabeth." For her part, Queen Barbara, a member of the Portuguese royal family, advocated a policy of neutrality that coincided with the opinions of her leading courtiers, far different from the irredentist policy of Elizabeth.
Ferdinand's rule reaped good fortune and the rewards of Philip V's reforms. He was a charitable ruler, relieving drought-stricken Andalusia from all taxes in 1755 and devoting large sums of money to the reconstruction of that part of the country. As king, he deferred many of his judgments to his leading ministers.
Ensenada continued to be the leading member of court in the early part of Ferdinand's reign. After the successful alliance with France in the War of the Austrian Succession, he advised strengthening that bond as a means of protecting Spain's vulnerable security and checking British interests in her empire. He was opposed by an anglophile faction at court led by Jose de Carvajal y Láncaster, a mixed British-Spanish gentleman descended from the House of Lancaster. Carvajal believed that the key to Spain's defense and modernization was a closer alliance with Britain, whose naval power could complement Spain's empire and whose commercial strength could encourage economic development in Spain. Carvajal's most enduring accomplishment was the 1750 agreement with Portugal, which ended a long, low-level conflict in Banda Oriental (southern Uruguay) between the two countries.
The agreement with Portugal, however, was to have important political consequences for Spain. The agreement traded seven Jesuit-established and -operated missions in southern Uruguay for Portuguese-founded and -controlled Uruguay. The plan (opposed by both the Jesuits and the British) led to resistance led by the Jesuits and their native Guaraní allies in the area. Both Spain and Portugal responded in force to the crisis, suppressing the Jesuits and Guaraní in the War of the Seven Reductions. The war broke a traditionally friendly relationship between the Spanish government and the Jesuits and launched a period of anti-Jesuit policies both in Spain and Portugal that would be continued by Charles III of Spain.
A scandal at court, resulting from a conspiracy between Carvajal and the British ambassador, led to the embarrassment of Ensenada and his disrepute at court. When Carvajal died in 1754, Ferdinand and his wife dismissed Ensenada, fearing that the Marquis's French sympathies would lead to an alliance with Louis XV of France and war, without Carvajal's British sympathies to counterbalance him. An Irishman, Ricardo Wall, was appointed to replace Ensenada as chief minister. Wall, a staunch defender of Spain's neutral policy, successfully kept the country out of war for the remainder of Ferdinand's reign, in spite of the outbreak of the Seven Years' War.
Although his wife, Barbara, had always feared that Ferdinand would die before her and leave her destitute – she had amassed huge personal wealth as a safeguard against this – she was the one who would precede him, dying in 1758. Deeply distraught by her death, Ferdinand became apathetic to his duties as king, and indeed, suicidal. He died a year later, in 1759.

## Charles III, Enlightened despotism and reform (1759–1788)
### Italian experience, ascension to the Spanish throne

Ferdinand's successor was Charles III, son of Philip V by his second wife, Elizabeth Farnese. Charles was the half-brother of Ferdinand VI, and not initially expected to ascend the throne of Spain. Since Ferdinand had no children, it was clear that Charles would ascend to the throne. In his half-brother's last years of ill physical and mental health and erratic behavior, Charles kept up to the minute on happenings in Spain. He learned of the "spreading administrative paralysis, breakdown of responsibility, and delays in making key decisions" and was worried that France and Spain in the event might attempt to carve up the Spanish Empire. At age 16, Charles had been named Duke of Parma at his mother's demand. His experience there gave him a place to experiment with the practice of enlightened despotism. He exhibited a martial spirit early on, acquiring Naples and Sicily by force of arms and becoming their king, though his tastes were generally more peaceful. Upon arriving in Spain, he did not share Carvajal's taste for an alliance with Britain.
He had been introduced to reform by his mentor in Sicily, Bernardo Tanucci. Although Tanucci remained behind in Naples to advise Charles's son, King Ferdinand IV, as the two thrones could not be united by consequence of the Treaty of Vienna, Charles carried with him a cadre of Italian reformers who saw potential in the Spanish bureaucracy for modernization. The architect of the first phase of Charles III's reforms was one such Italian, Leopoldo de Gregorio - a man of humble origins whose ability as a military supplier for the Neapolitan army impressed the king and raised him to royal prominence. Created "Marquis of Esquilache" in 1755, Gregorio was one of Spain's leading statesman from the arrival of Charles III to the Marquis's death in 1785.

### Seven Years' War

Although the Seven Years' War had broken out in 1756, Spain had managed to remain strictly neutral under the ministry of Ricardo Wall, who continued to lead Spain's government in the early years of Charles III. Charles, however, bore a grudge against the English and as the war became increasingly desperate for France, he went against his chief minister's wishes and intervened on France's behalf in 1762. Spain fared poorly in the war, and the British captured Havana and Manila within a year. Spanish Florida was ceded to the British and Spain recognized British control over Menorca and Gibraltar in 1763, although the vast territory of Louisiana was given to Spain to compensate her for her losses. After the Treaty of Paris (1763), however, Spain could focus on internal development.

### Reforms

By far the largest landholder in Spain, the Church had been treated with great charity by the Spanish kings of the seventeenth century - Philip IV in particular donated large tracts of territory in religious piety. Much of this land went unused, and a great deal of the remainder of the country was owned by gentlemanly hidalgos who lived primarily off of the state. The system had grown long obsolete, and a growing population (Spain's population would increase from eight to twelve million between 1700 and the French Revolution) had put great pressure on the government to reform. Like neighboring Portugal, Spain's antiquated bureaucracy had grown dependent on the income and production from its colonies to support an unmanageable, large class of landowning, non-productive gentlemen and clergy.
The Enlightenment had been a force of anticlericalism in Europe, and Charles, in applying its lessons to Spain, saw it less stridently, seeking to strengthen the power of the crown (regalism) against that of the Catholic Church and the papacy. Ferdinand VI had undertaken to reduce the power of the Jesuits in Spain and had arranged for Spain's kings to appoint her own bishops, a power that France's kings had held since the fifteenth century. Charles, who advocated a radical policy and rapid modernization of the country, expelled the Jesuit Order from Spain completely in 1767 (see Suppression of the Jesuits). The Inquisition was scaled down, but not completely eradicated; as late as 1787, a woman was burned as a witch.
Land reform and agricultural reform alienated both clergymen and landed elites in Spain. Charles chose to ally with the merchantmen of his country and a growing middle class that came with a new prosperity during his rule. An advocate of free trade, Charles reduced the tariff barriers that had been the core of Spanish trade policy for centuries. The Marquis of Esquilache successfully liberalized the grain trade in 1765, but riots broke out in 1766 in due to the rise in grain prices.
Although he believed in centralized government and continued the reforms of his predecessors to reduce the autonomy of the regional parliaments that could potentially challenge his power, Charles approved of establishing prototype chambers of commerce, the Economic Societies of the Friends of the Country) to encourage local economic development and initiative. The national infrastructure was improved to foster the development of Spanish manufacturing, and a unified monetary system was implemented.
The reforms were not without costs, however, and in 1766, in the context of a worldwide grain shortage and the difficulties of the recently liberalized grain trade, riots broke out in Madrid and other cities in Spain against rising grain prices. The "Motin de Esquilache" drove the king from his capital and embarrassed the king's chief minister the Count of Aranda. Aranda gained prominence during the crisis and led the government in the king's absence. He was the only titled aristocrat in Charles's administration; the king generally preferred men of lower social origin who were university graduates from outside Castile. Charles granted noble titles to able men in his administration, who became part of a loyal and progressive bureaucracy. Charles removed Esquilache from power in Madrid, naming him Ambassador to Venice.
Aranda, as the leader of the Aragonese faction at court, favored a more decentralized system of government. Aragon's special rights in Spain had been suppressed when the Bourbon monarch Philip V ascended the throne. Following the ouster of Esquilache, for a time Aranda was the leading figure in Spanish politics. A criminal prosecutor named José Moñino gained prominence as the investigator of the riots and as an outspoken supporter of the king's reformist policies. The riots were attributed to the Jesuits, who were advocates of papal power, when Bourbons were centralizing regal power. The role of the Jesuits in the riots was named as the reason to oust the Jesuits from Spain and its empire in 1767. In 1773 Moñino succeeded in having Pope Clement XIV revoke the papal charter of the Jesuit Order. For this success, Charles named Moñino the Count of Floridablanca.
The new count was named chief minister in 1777 and undertook the material reform of the Spanish bureaucracy. His chief bureaucratic successes were the creation of a true cabinet system of government in 1778 and the creation of Spain's first national bank, the National Bank of San Carlos, in 1782. Recognizing the damage done to Spain's education system after the expulsion of the Jesuits, Floridablanca undertook drastic reform to hire new teachers and modernize Spain's education system. Floridablanca's most enduring accomplishment was the opening of free trade with Spain's empire in the New World to foreigners.
Although Floridablanca – like Carvajal before him – admired British governance and believed that a cordial relationship with George III of Great Britain was the best policy for Spain, the American Revolutionary War was too great an opportunity for Charles III to pass up, and Spain went to war against Britain alongside France and the Dutch Republic in 1779, after providing monetary assistance to the rebels. Bernardo de Gálvez, the governor of Spanish Louisiana, led the campaign to retake the forts lost to the British since 1762; Pensacola, Florida was retaken in 1782, and The Bahamas were seized later that year. The Treaty of Paris (1783) restored much of what Spain had lost in the Seven Years' War, including Florida.

### Assessments of Charles's rule

Charles is considered "the most successful monarch of Spain after Ferdinand and Isabel" in the late fifteenth and early sixteenth centuries. "He deserves high a rank among the enlightened despots of the eighteenth century, for in many ways he accomplished more than such famous rulers as Frederick the Great of Prussia, and Joseph II of Austria." Historian Stanley Payne writes that Charles III "was probably the most successful European ruler of his generation. He had provided firm, consistent, intelligent leadership. He had chosen capable ministers....[his] personal life had won the respect of the people." John Lynch's assessment is that in Bourbon Spain "Spaniards had to wait half a century before their government was rescued by Charles III, a giant among midgets."

## Charles IV, decline and fall (1788–1808)

King Charles III died on 14 December 1788 and was succeeded by his son, Charles IV. Seven months later, French revolutionaries stormed the Bastille, launching the French Revolution. In its aftermath with the rise of Napoleon Bonaparte, Spain felt the impact of the changed circumstances of France.
Charles III's eldest son Infante Philip, Duke of Calabria was both epileptic and mentally disabled and was passed over for the throne in favor of his second son, Charles. Charles IV was seen by many of his time as being as uninterested in politics just as Ferdinand VI had been. After growing up in Naples, Charles arrived in Spain, with his chief interest being hunting. For all of his rule, his policies were dominated by the will of his wife, Maria Luisa of Parma. Charles retained many of the ministers who served his father, but Charles and Maria Luisa fueled the rise of Manuel Godoy, a humble military officer who became the monarch's favorite, becoming chief minister in 1792.
The chief minister at the time of Charles IV's accession, José Moñino, 1st Count of Floridablanca, was not easily ousted and had many supporters in the court, particularly in Castile. Floridablanca's chief opponent in Spanish politics was Pedro Pablo Aranda, the leader of the Aragonese faction. Godoy made an alliance with Aranda, with whom Godoy sympathized, against Floridablanca. With the outbreak of the French Revolution and the execution of Louis XVI in 1792, Floridablanca's liberalism faced greater skepticism. Aranda and Godoy had Floridablanca imprisoned in 1792 on charges of embezzlement, of which he was later acquitted.
The spirit of reform that had made the reign of Charles III an era of renewed prosperity for Spain was extinguished in the reign of Charles IV. His queen and her lover were uninterested in the improvement of the Spanish bureaucracy and regarded Floridablanca as an exponent of the very sort of liberalism that was tearing France apart. The Aragonese faction led by Aranda, allied to many of the causes that had opposed Charles III's reforms, managed to undo much of the changes brought about in Charles III's tenure.
After the Execution of Louis XVI in 1793, 20,000 men were mobilized and marched to the French border, beginning the War of the Pyrenees. The army, however, had been allowed to languish in Charles III's reign, and it was ill-equipped and ill-trained to invade France successfully. After a failed invasion of Rousillon, Navarre was quickly seized by the French, although the Spanish managed to hold their ground in Catalonia. Godoy, unimpressed with Spain's military effectiveness, decided to come to terms with the new French Republic, and in 1795 signed the Treaty of Basel, guaranteeing peace with France with the cession of Santo Domingo to the Republic.
Godoy, having abandoned his Austrian and British allies, faced a decision: whether to continue to fight the Revolutionary France that had already defeated Spain once before, or to join the French side and hope for better times. The Spanish, after initially opposing the French, signed the Treaty of San Ildefonso in 1796, allying Spain to France, in exchange for the French permitting Charles IV's cousin Ferdinand to continue ruling Parma. In response, the British blockaded Spain in 1797 and cut off her colonial empire from the mother country. By the end of 1798, the Spanish fleet had been defeated by the British, and Menorca and Trinidad were occupied. In 1800, the Spanish returned Louisiana to France.
The Portuguese, who opposed the French, continued to trade with the British in spite of a series of French demands that they close their ports to British ships. In 1801, the Spanish delivered an ultimatum on behalf of France, and in the following War of the Oranges, occupied the town of Olivenza (Olivença) before the Portuguese agreed to the Spanish and French demands. The town – which is disputed to the present day – continues to be administered by Spain, though Portugal contends that the Congress of Vienna restored it to Portugal.
The Treaty of Amiens in 1802 provided for a temporary truce in hostilities, only to be broken in 1804 when the British captured a Spanish treasure fleet off Cádiz. The French planned an invasion of England in the coming year; the Spanish fleet was to be an integral part in assisting this invasion. At the Battle of Trafalgar in 1805, the Spanish navy and the French Mediterranean fleet, attempting to join forces with the French fleets in the north for the invasion, were attacked by Admiral Lord Horatio Nelson at the head of a British fleet in one of history's greatest naval engagements. The disastrous defeat that the Spanish and French suffered assured British dominance at sea and seriously shook the resolve of the Spanish, who began to doubt the usefulness of their always mutually suspicious alliance with Napoleon's regime.
After Trafalgar, Godoy withdrew from the Continental System that Napoleon had devised to combat Britain, only to join it again in 1807 after Napoleon had defeated Prussia and Russia in the War of the Fourth Coalition. Napoleon, however, had lost his faith in Godoy and King Charles; there was also growing support in Spain for the king's son, Ferdinand, who opposed the popularly despised Godoy. Ferdinand, however, favored an alliance with Britain, and Napoleon, always suspicious of the Bourbons, doubted the trustworthiness of any Spanish royalty.

## Ferdinand VII and the Napoleonic upheaval (1808–1814)

In 1808, Spain and France agreed to the partition of Portugal, which had renewed its support of the British after Trafalgar. The French and Spanish quickly occupied the country. Prince Ferdinand traveled to France, and rumors spread that he was asking for Napoleon to oust Godoy from power; the Spanish King sided with his favorite. Riots broke out in various parts of Spain, and in the Tumult of Aranjuez, Godoy was arrested and Charles IV forced by his son and heir Ferdinand to abdicate in his favor. Napoleon, however, had lost confidence in the Spanish monarchy and when Ferdinand traveled to France to obtain the French emperor's support, Napoleon pressured Ferdinand to abdicate in favor of his father Charles IV, who had abdicated under pressure. Charles IV himself abdicated in favor of Napoleon, since he did not wish his detested son to return to the throne. Napoleon then placed his older brother Joseph Bonaparte on the throne. As a way to legitimize the transfer of power, Napoleon summoned a group of Spanish aristocrats to Bayonne, where they signed and ratified the Bayonne Constitution on 6 July 1808, Spain's first written constitution. The Spanish chose to resist, sparking the Peninsular War.