The same causes which operated in Venezuela and Quito, and have been already stated, were felt in Chile, and produced similar effects. On the 18th July, 1810, the president Carrasco was deposed by the native inhabitants, under the plea of his incapacity of preserving this part of the Spanish dominions for Ferdinand, when he should be freed from his captivity, and a junta which was formed of the Cabildo took upon itself to govern according to the old system, but with the secret intention of following the course and example of Buenos Ayres in declaring her independence. In 1811 Don Juan Jose Carrera, the son of Don Ignacio Carrera of Chile (who had been sent to Europe, and in the continental war had attained the rank of a lieutenant-colonel and commandant of a regiment of hussars) crossed the Atlantic to succour his native country, which he was considered by his friends as the only person capable of saving from the impending ruin which threatened it from the result of the steps taken; and he was in consequence nominated by the junta supreme president of the congress which was convened, besides which he was appointed general in chief of the army about to be formed. The first step which Carrera took was to establish a defensive army, which he immediately began to recruit and discipline, choosing his officers from among the most zealous friends of liberty. He constituted himself colonel of the national guards, appointed his elder brother, Don Jose Miguel, colonel of grenadiers, and his younger, Don Luis, colonel and commandant of artillery. At this time the principal military force of Chile was at Conception; indeed the whole of the force, excepting two companies, which had always been on duty in the capital, and about fifty stationed as a garrison at Valparaiso, was employed on the frontiers of Arauco. On hearing of what had taken place in the capital, the troops at Conception declared themselves in favour of the cause of liberty. The inhabitants of Conception pretended that their city was better calculated to be the seat of government than Santiago; and as the troops were principally composed of Pencones, natives of the place, they were persuaded to join in the request, which occasioned some difficulties to Carrera, and it was feared that this untimely pretension would be the cause of a civil war; but it was finally adjusted that, for a specified time, the troops of Conception should remain to the southward of the river Maule, and those of Santiago to the northward. This gave Carrera an opportunity to gain over the troops, which he did by sending emissaries to Conception, when a general reconciliation took place, and the whole of the troops were placed under the command of Don Juan Jose Carrera.

The Spanish troops from Lima, Coquimbo and Chiloe, under the command of Colonel Gainsa, began hostilities in the south of Chile; various actions and skirmishes occurred between them and the undisciplined Chileans, the result being favourable to the latter. In 1812, Don Bernardo O'Higgins (then a captain of militia) joined Carrera, who bestowed on him the rank of lieutenant-colonel of the line, and shortly afterwards raised him to that of brigadier general, for the important services he rendered with the Guerilla parties.

In 1813, the three Carreras, with a considerable number of their officers, were retaken prisoners by the Spaniards, and confined at Talca. The command of the army devolved on O'Higgins, he being the senior officer. He availed himself of this opportunity, assumed the civil power, caused himself to be proclaimed president, and appointed a substitute in the capital to govern during his absence. The Carreras being possessed of money bribed the soldiers at Talca and made their escape. O'Higgins instantly offered a reward for their apprehension. The three Carreras immediately set off to Santiago, disguised as peasants, and made themselves known to some friends; Don Luis was apprehended and imprisoned; Don Juan Jose went in his disguise to the artillery barracks, and having entered, discovered himself to the officers and soldiers, who welcomed his arrival, and promised to support him; in consequence of which he marched with the soldiers to the plasa, and liberated his brother Luis. The citizens promptly reinstated the Carreras, and the news being conveyed to O'Higgins, he marched his army towards the capital, leaving the enemy to avail himself of the civil discords of the Chileans. Carrera proposed to unite their respective forces, proceed against the common enemy, and leave their private quarrels to be decided by the fortune of war, or by the suffrages of the people. To these proposals O'Higgins objected, and the two generals prepared for action. Carrera chose the plain of Maypu, when O'Higgins soon began the attack, and was repulsed; the peasantry, under the command of Carrera, although victorious, called on their countrymen to desist, not to fly, but to surrender to their first and best chief; this they did, were generously received, and forgiven. O'Higgins and his principal officers were made prisoners. They all expected that their offended general would bring them to judgment as traitors; but they were pardoned, restored to their former situations in the army, and O'Higgins was reinstated in the command of the van-guard, and received orders to march towards Rancagua, where Carrera soon afterwards repaired with the remainder of the army. The Spaniards profited by the dissentions of the patriot chiefs, recruited and disciplined more troops, and invested the town of Rancagua on the first of October, 1814. Carrera and his troops defended themselves here forty-eight hours, and when their ammunition was expended and they were obliged to evacuate the place, they cut their way through the ranks of the Spanish soldiery sword in hand. General Carrera and his two brothers, O'Higgins, Benevente, the unfortunate Rodrigues, and several of the more wealthy citizens, crossed the Cordillera, leaving General Osorio in possession of the whole of Chile.

The Spanish regime being thus re-established in Chile, the different functionaries who had been deposed resumed their offices, and a new tribunal called de la purification was established, through which ordeal all those natives who wished to be considered as loyal subjects to Spain had to pass. It was composed of Spaniards, principally officers, having the celebrated Major San Bruno as president. Nothing can be imagined more arbitrary than the conduct of this tribunal; its assumed duties were to examine the proceedings of the inhabitants, and, independently of any established laws or set forms, to sentence or acquit. The prisons were filled with the objects of persecution, the places of exile were crowded with the victims of this political inquisition, and Chile groaned under the unwise administration of Osorio. This tyrannical general and Marcó, instead of pursuing conciliatory measures, which would have attached the mal-contents to their party, adopted every kind of persecution, and cultivated distrust; until enmity, which ripened in secret, at the first favourable opportunity produced conspiracies and all the fatal effects of revenge.

General Carrera pursued his route to Buenos Ayres, where he embarked for the United States to solicit assistance; while O'Higgins, Rodrigues, McKenny, and Calderon began to recruit and discipline a new army for the re-occupation of Chile: the command of the army was given to San Martin; it crossed the Cordillera, and the battle of Chacabuco was fought on the twelfth of February, 1817, the result of which has already been stated. On the arrival of the patriot troops in Santiago an elective government was formed, of which General San Martin was nominated the supreme director; but he declined the offer, and recommended his friend, General O'Higgins, to fill the place.

The refusal of San Martin to accept the first and highest post of honour in Chile was misunderstood at the time; it was construed into a deference to the superior abilities of O'Higgins, and to modesty on the part of the hero of Chacabuco; whereas some who knew him better were persuaded, that he intended to govern the government, and to make it subservient to his own purposes. Besides, a wider field for the ambition of San Martin now presented itself. He began to look forward to Peru, which afterwards became the theatre of his warlike virtues.

The Spaniards kept possession of Talcahuano, as well as the southern provinces, and received supplies from Peru, principally composed of the regiment of Burgos, one of the finest bodies of troops ever sent from Spain. General Osorio again took the command of the army, and marched towards the capital, while the patriots mustered all their forces to oppose him. The Spanish force was composed of about five thousand regulars, and it gained several advantages, particularly one at Cancharayada, where they surprised the Chilean army in the night, and completely dispersed it; and had Osorio continued his march, he might have entered the capital without any opposition; but he remained at Talca, and allowed the patriots to collect their scattered forces. This they were not slow in performing, for on the fifth of April they presented themselves on the plain of Maypu about seven thousand strong, including the militia; indeed very few of them could be called veterans, except in their fidelity to the cause of their country. O'Higgins having been severely wounded in his right arm at Cancha-rayada, could not take the field, but remained in his palace at Santiago. San Martin and Las Heras commanded the patriots, and Osorio the royalists on this memorable day, which sealed the fate of Chile. The conflict was obstinate and sanguinary during the greater part of the day; in the afternoon fortune appeared to favour the Chileans, when lieutenant-colonel O'Brian observed, that the regiment of Burgos were endeavouring to form themselves into a solid square; he immediately rode up to General San Martin; and begged him to charge at the head of the cavalry and prevent the completion of this manœuvre, stating, that if it were effected nothing could prevent their marching to the capital. San Martin, instead of charging at the head of the cavalry, ordered O'Brian to charge, which he did, and completely routed the Spaniards, and gave the victory to the patriots. Osorio on observing the fate of the regiment of Burgos fled with a few officers and part of his body-guard. When O'Brian returned to the commander in chief and reported to him the news of the victory, he was answered by a bottle of rum being offered to him by the hero of Maypu, accompanied with this familiar expression, toma! take hold!

Of the five thousand men commanded by Osorio two thousand fell on the field, and two thousand five hundred were made prisoners, with one hundred and ninety-three officers, who were immediately sent across the Cordillera to the Punta de San Luis and Las Bruscas; General Osorio, with about two hundred followers, escaped from the field of action and fled to Conception.

This victory over the Spaniards gave to the Chileans that complete independence for which they had been struggling ever since 1810; but the glory of the achievement was tarnished by what took place as well at Mendosa on the east side of the Cordillera as at Quillota on the west. On the return of General Carrera from the United States, bringing with him several officers and some supplies of arms, for the purpose of equipping an expedition for the liberation of his country, he found, on his arrival at Buenos Ayres, that his two brothers were on their parole of honour in this city, and were not allowed to return home nor to join the army. This proceeding astounded Carrera, but he had scarcely time to inquire into what had taken place, when he was himself arrested and placed on board a gun brig belonging to Buenos Ayres; at which time his two brothers, fearing the same fate, fled, Don Luis on the nineteenth of July, 1817, and Don Jose Miguel on the eighth of August: on the seventeenth they were apprehended near Mendosa, and thrown into prison, when they were in hopes of having been able to cross the Cordillera and again to serve their country.