On 17 December 1819 the Congress of Angostura declared Gran Colombia an independent country. After two more years of war, which killed half of Venezuela's Caucasian population,[citation needed] the country achieved independence from Spain in 1821 under the leadership of its most famous son, Simón Bolívar. Venezuela, along with the present-day[update] countries of Colombia, Panama, and Ecuador, formed part of the Republic of Gran Colombia until 1830, when Venezuela separated and became a sovereign country.

Criollos resented the mercantilist policies of Spain. Trade was only allowed in Pacific ports which was a terrible burden for Argentina, Paraguay, and the Caribbean colonies. This is significant as Cuba and Puerto Rico were forced to allow free trade in 1763 by Britain and remained loyal, while the remaining three were the first to declare independence. Venezuela was nearer to Spain than most colonies so it was the first to hear of Joseph Bonaparte's takeover of Spain and it found the trade restrictions the most irksome. Loyalist criollos were fearful of a Haitian style revolution and slavery's abolition. Later events would show that only the whites in the Andean region were enthusiastic about independence. The French invasion of Spain in 1808 led to the collapse of the Spanish Monarchy. Most subjects of Spain did not accept the government of Joseph Bonaparte, placed on the Spanish throne by his brother, Emperor Napoleon Bonaparte of France. At the same time, the process of creating a stable government in Spain, which would be widely recognized throughout the empire, took two years. (See Junta (Peninsular War).) This created a power vacuum in the Spanish possessions in America, which created further political uncertainty. On 19 April 1810 the municipal council of Caracas headed a successful movement to depose the Spanish Governor and Captain General, Vicente Emparán. A junta was established in Caracas, and soon other Venezuelan provinces followed suit. The reverberations of this act of independence could be felt throughout Venezuela almost immediately. Across Venezuela, towns and cities decided to either side with the movement based in Caracas or not, and de facto civil war ensued throughout much of Venezuela. The Caracas Junta called for a congress of Venezuelan provinces to establish a government for the region. Initially both the Junta and Congress upheld the "rights of Ferdinand VII," meaning that they recognized themselves to still be part of the Spanish Monarchy, but had established a separate government due to the French invasion of Peninsula. As the Congress deliberated, a faction proposing outright independence quickly won favor. Persons such as Francisco de Miranda, a long-term Venezuelan expatriate, and Simón Bolívar, a young, Criollo aristocrat—both influenced by Age of Enlightenment ideas and the example of the French Revolution—led the movement. The Congress declared Venezuela's independence on 5 July 1811, establishing the Republic of Venezuela.

Even before the Congress began its sessions in November 1810, a civil war started between those who supported the juntas, and eventually independence, and royalists who wanted to maintain the union with Spain. Two provinces, Maracaibo Province and Guayana Province, and one district, Coro, never recognized the Caracas Junta and remained loyal to the governments in Spain. Military expeditions to bring Coro and Guayana under the control of the Republic failed. In 1811 an uprising in Valencia against the Republic was successfully suppressed. By 1812 the situation increasingly became aggravated for the young Republic. It was short of funds, Spanish Regency set up a blockade (although it was easily bypassed by British and American merchant ships), and on 26 March 1812, a devastating earthquake hit republican areas. In these desperate moments, Miranda was given dictatorial powers, nevertheless he was unable to stem the royalist advance headed by Captain Domingo de Monteverde. By midyear, after the Battle of San Mateo, the Republic collapsed. Miranda capitulated to Monteverde and signed an armistice on 25 July 1812.

Bolívar and other republicans continued the resistance from other parts of the Spanish South America and the Caribbean, or organized guerrilla movements in the interior of the country. In 1813 Bolívar joined the army of United Provinces of New Granada. After winning a series of battles, Bolívar received the approval of the New Granadan Congress to lead a liberating force into Venezuela in what became known as the Admirable Campaign. At the same time, Santiago Mariño invaded from the northeast in an independently organized campaign. Both forces quickly defeated the royalist troops in various battles, such as Alto de los Godos. Bolívar entered Caracas on 6 August 1813, proclaiming the restoration of the Venezuelan Republic and his supreme leadership of it, something which was not fully recognized by Mariño based in Cumaná, although the two leaders did cooperate militarily.

In the viceroyalties of La Plata and New Granada the Creoles displaced the Spanish authorities with relative ease, as Caracas had done at first. The autonomous movement swept through New Granada, but the country remained politically disunited. Bogotá inherited the role of capital from Spain, but the royalists were entrenched in southern Colombia (Popayán and Pasto). Cali was a bastion of the independence movement just north of royalist territory. Cartagena declared independence not only from Spain but also from Bogotá. Bolívar arrived in Cartagena and was well received, as he was later in Bogotá, where he joined the army of the United Provinces of New Granada. He recruited a force and invaded Venezuela from the southwest, by crossing the Andes (1813). His chief lieutenant was the headstrong José Félix Ribas. In Trujillo, an Andean province, Bolívar emitted his infamous Decree of War to the Death with which he hoped to get the pardos and any mantuano who was having second thoughts on his side. At the time that Bolívar was victorious in the west, Santiago Mariño and Manuel Piar, a pardo from the Dutch island of Curaçao, were successfully fighting royalists in eastern Venezuela. Quickly losing ground (much as Miranda had a year earlier) Monteverde took refuge in Puerto Cabello, and Bolívar occupied Caracas, re-establishing the Republic, with two "states", one in the west headed by Bolívar and one in the east headed by Mariño.

But neither the successful invasions nor Bolívar's decree were provoking a massive enrollment of pardos in the cause of Independence. Rather it was the other way around. In the llanos, a populist Spanish immigrant caudillo, José Tomás Boves, initiated a widespread pardo movement against the restored Republic. Bolívar and Ribas held and defended the mantuano-controlled center of Venezuela. In the east, the royalists started recovering territory. After suffering a setback, Mariño and Bolívar joined their forces, but they were defeated by Boves in 1814. Republicans were forced to evacuate Caracas and flee to the east, where, in the port of Carúpano, Piar was still holding out. Piar, however, did not accept Bolívar's supreme command, and once again Bolívar left Venezuela and went to New Granada (1815). (See Bolívar in New Granada).

Resistance to the Republic this time came from the people of the vast southern plains, the Llaneros, who organized under the command of Spanish immigrant, José Tomás Boves. The war was transformed. The Llaneros had a dislike for the urban and elite Criollos who led the independence movement. Boves's Llanero army routinely killed white Venezuelans.[2] Negroes were supplied with maps and lists of rebel plantations by royalists. The Llanero army routed the patriots in the center of the country. Finally Boves marched towards Caracas, forcing the Republicans to flee to the east of the country, ending the second republic. Boves died shortly thereafter in battle, but the country had been returned to royalist control.

In Spain, anti-French forces had liberated the country, and the restored Ferdinand VII sent a large expeditionary force to Venezuela and New Granada under Pablo Morillo, who had distinguished himself during Spain's War of Independence. The traditional image of the Venezuelan llanos swarming with caudillos like Boves exaggerates the situation. Boves was the only significant pro-Spain caudillo and he was acting in concert with Francisco Tomás Morales, who was a regular officer of Spain. In the Battle of Urica, Boves was killed and Morales took command and carried out mopping up operations against the remaining patriot resistance, which included the capture and execution of Ribas. As was still common in the early 19th century, Morales had his head boiled in oil (to preserve it) and sent to Caracas. (See the Execution of Miguel Hidalgo in Mexico.) Morillo arrived in Venezuela and began operations with Morales.

Royalist forces under Morillo and Morales captured Cartagena and Bogotá in 1816. Before leaving for New Granada Morillo had decommissioned most of the irregular forces that had fought under Boves, except those that he took to New Granada. With little prospects, some pardos and llaneros began to join the rebellions that were breaking out against Spanish rule in the broad plains of southern Venezuela. In the meantime, Bolívar chose to sail to Jamaica to enlist British aid, which was refused. From there, he went to Haiti, which had been the first Latin American republic to become independent. With the support of the Haitian president Alexandre Pétion and with the naval aid of Luis Brión, another émigré, who was a merchant from Curaçao, Bolívar returned to Margarita Island, a secure republican redoubt, but his command of the republican forces was still not firm. Mariño, who had come back with Bolívar from Haiti, headed his own expeditions and succeeded in temporarily capturing Cumaná in 1817. With Brión supplying a small fleet, Bolívar sailed west along the Venezuelan coast to Ocumare de la Costa (the Expedition of Los Cayos), where, in fulfillment of Pétion's request, he officially proclaimed the end of slavery (although this went unheeded). Morales, back in Venezuela after subduing New Granada, attacked the republican expeditionary force with an army that vastly outnumbered the republicans. Bolívar fled, sailing once again to Haiti with Brión. However, Piar and Gregor MacGregor, a Scottish soldier of fortune, who had previously been active in New Granada, managed to escape with their forces into the interior of the country, defeating Moreles at El Juncal in September 1816 before moving south to Guayana.

Boves's locally-raised Llanero army was replaced in 1815 by a formal expedition sent from Spain under the leadership of Pablo Morillo. It was the largest expedition the Spanish had ever sent to the Americas. Venezuela's proximity to Cuba, Puerto Rico and Spain made it the first target of the royalist counterattack. The Llaneros were either demobilized or incorporated into the expeditionary units. The republican patriots found themselves once more dispersed, and again the war took a local character. Different patriot guerrilla bands formed, but could not agree on a united leadership, much less a united strategy. One group of patriots launched an expedition to eastern Venezuela that ended in failure. Bolívar thereafter sought to join forces with Manuel Piar, another patriot leader but differences between them prevented a united republican front. Bolívar then went to the Llanos where he joined forces with José Antonio Páez, but a failed attack on central Venezuela forced Bolivar to retreat back to Apure. Morillo counterattacked successfully but was defeated at the Battle of Las Queseras del Medio. A long-term stalemate ensued in which the royalists controlled the highly populated, urban north and the republicans the vast, under-populated plains of the south.

Bolívar and Brión returned and tried in 1817 to capture Barcelona, where the Spaniards repulsed them. In the meantime, Piar and Mariño had occupied defenceless Angostura (a city at the narrowest and deepest part of the Orinoco River, hence its name, subsequently changed to Ciudad Bolívar), to where Bolívar headed and was chosen as supreme leader of the independence movement. (It was at this time that Bolívar ordered the addition of a new star for Guayana to the seven stars on the Venezuelan flag, which represented the number of provinces that originally had favored independence. Since Bolívar plays a central role in the symbolism of the current Venezuelan government led by Chávez, this long-forgotten change was revived in the 2006 revision to the flag.) Once in Guayana, Bolívar quickly cashiered Piar, who had been trying (or was accused of trying—historians still debate this) to form a pardo force of his own, by having him arrested and executed after a court martial in which Brión was one of the judges. British veterans of the Napoleonic wars began arriving in Venezuela, where they formed the nucleus of what later became known as the British Legion. Morillo returned to Caracas and Morales was given troops to dominate eastern Venezuela, which he did successfully. Francisco de Paula Santander, a New Granadan who had retreated to the llanos after Morillo's invasion, met with Bolívar and agreed to join forces. Morillo's other lieutenant, the second in command of the expeditionary force, Miguel de la Torre, was ordered to put down a significant rebellion in the llanos of Apure led by José Antonio Páez. At the time in the Southern Cone of South America, José de San Martín had concluded the liberation of Chile with the essential support of the Chilean Bernardo O'Higgins.

The year 1818 saw a stalemate between the patriots based in Angostura (and free-wheeling in part of the llanos) and Morillo (entrenched in Caracas, triumphant in eastern Venezuela, and operating in the llanos as far as Apure). This is the time during which (according to Marx), Bolívar dilly-dallied and lost one skirmish after another, also saying that European officers in Angostura were egging him on to attack the center of Venezuela. (Bolívar did attempt to do so, but suffered defeat at La Puerta.) At the time James Rooke did in fact command over 1,000 European soldiers within Bolívar's army in Venezuela. But Morillo had larger forces, and not just of Spanish line troops but also of pardos still loyal to the Spanish crown.

In 1819 Bolívar proclaimed the republic of Great Colombia, which included Venezuela and New Granada. New volunteers arrived in Venezuela, though most, like those that preceded them, were in essence mercenaries probably under the illusion that there were fortunes to be made in Venezuela, which was hardly the case. There is no evidence that the British government was backing them, but since Spain was no longer a British ally, it wasn’t hindering them either. In Europe, generally, Bolívar's name was known as was the Spanish American movement for independence, which had the sympathy of every liberal-minded person, as did the independence of Greece, then also in the process of emancipation. Morillo had his hands full and pardos were starting to look towards patriot leaders. Campaigns in eastern Venezuela began turning the tide for independence and in the llanos Páez defeated Morillo and Morales in Apure. This cleared the way for Bolívar and Santander to invade New Granada, where, in Pantano de Vargas, the Spaniards were defeated in a battle in which the British Legion played a central role and its commander, Rooke, was killed in action. In the battle of Boyacá (1819), Spanish power was crushed in New Granada, except in the south. Páez occupied Barinas and, from New Granada, Bolívar invaded Venezuela.

In 1819, to break this impasse Bolívar invaded New Granada, which had been reconquered by Morillo's expeditionary force three years later. Bolívar decisively defeated the royalists at Boyacá. With the liberation of New Granada, the republicans had a significant base from which to attack Morillo's forces. A republican Congress at Angostura (today Ciudad Bolívar), which already had a small New Granada delegation, declared the union of New Granada and Venezuela in a Republic of Colombia (the Gran Colombia of contemporary accounts) to present a united front against the Spanish Monarchy.

In 1821 the Colombian army won a decisive victory at the Battle of Carabobo, after which the only cities in the hands of the royalist forces were Cumaná, which fell shortly thereafter, and Puerto Cabello, which managed to resist a siege before finally capitulating in October 1823.

The Spanish sent a fleet in 1823 to reconquer the country but were defeated at the Battle of Lake Maracaibo. The fight for independence, which killed half of Venezuela's white population,[3] was finally over in Venezuela. In the following years Venezuelan forces, as part of the army of Gran Colombia, continued campaigning under the leadership of Bolívar to liberate the southern parts of New Granada and Ecuador. Once this was accomplished, Gran Colombia continued its fight against the Spanish in Peru and Bolivia, completing the efforts of Chilean and Argentine patriots, such as José de San Martín, who liberated southern South America.