The early decades of the Mexican republic (proclaimed in 1823, when Iturbide abdicates) fall into a pattern characteristic of much of Latin America at the period. Political allegiances divide into two broad camps, associated with the liberals (anti-clerical and favouring a federal constitution with maximum independence for the provinces) and the conservatives (believing in strong central rule and an important role for the church - see Liberal and conservative).

These distinctions often dignify what is in effect little more than factional anarchy. The situation is further confused by the personal dominance of leaders in the local caudíllo tradition.

Mexico has a quintessential caudíllo in the person of Antonio López de Santa Anna. An army officer of considerable charisma, but entirely lacking in consistency or scruple, Santa Anna manages to become president of Mexico for five separate periods between 1833 and 1855 - often with dictatorial powers, and at different times representing liberal and conservative interests.

After being banished in 1855, Santa Anna attempts a final return to Mexican politics ten years later. He offers his services first in support of the emperor Maximilian and then, when this approach is rejected, volunteers to assist the forces trying to overthrow the emperor.

Santa Anna is by now too old, and his scheming too cynical even by his own standards, for this final ploy to succeed. But the very attempt means that his career, spanning the first four decades of independence, involves him in the three great issues which shape the early republic - the war in Texas (1835-6), the war against the United States (1846-8), and the brief empire imposed by France (1864-7).

The first of these crises is the result of Mexicans becoming a minority within Texas. The issue flares up during a period when Santa Anna is president with dictatorial powers. As an experienced army officer, he decides to take personal charge of the campaign - with disastrous results.

Texas: 1821-1836

From the 16th century Texas, though much neglected, has been a northern region of Spanish Mexico, or New Spain. It is formally recognized as such in the border agreement of 1819, when any US claims to the territory are relinquished. Just two years later Mexico wins independence from Spain.

Later in 1821 a 27-year-old American, Stephen Austin, arrives in Texas with 300 families to establish a settlement. They are the first of many. By the early 1830s there are some 30,000 Americans in Texas and only about 7000 Mexicans. Friction would be inevitable in these circumstances, but it is aggravated by the issue of slavery.

The Americans, from the southern states, bring slaves to work the cotton plantations which they establish. The republican government of Mexico, outlawing slavery, places garrisons in Texas in an attempt to discipline the unruly colonists.

In 1835 the colonists rise in rebellion and capture San Antonio. The town is recovered in March 1836 by the Mexican commander, Santa Anna, apart from one building - the Alamo, an old Franciscan chapel in a walled complex, which is held by fewer than 200 Texans (among them Davy Crockett). In the most famous event of early Texan history, the defenders hold out for twelve days and account for 1000 or more Mexicans before themselves being overwhelmed and killed.

The fall of the Alamo is followed by a massacre at Goliad where 300 Texan soldiers, surrendering after a battle, are killed in cold blood on the orders of Santa Anna. The settlers have recently declared their independence, as the republic of Texas. It is a claim soon sealed by a convincing victory.

In April 1836 Sam Houston surprises Santa Anna's army taking a siesta near the San Jacinto river. In a brief skirmish his men kill 600 and capture another 200, including Santa Anna. With this event the tide turns. Mexico makes no further effort to suppress the Texan rebellion, while nevertheless denying the independence of the self-proclaimed republic - of which Houston is elected president.

In the United States, on the other hand, the new republic is immediately recognized. There is also a widespread feeling that Texas should be included in the union, as the colonists themselves wish. In the 1844 presidential campaign the Democratic candidate, James Polk, is elected on a platform supporting the annexation of Texas. In 1845 congress admits the Texan republic (by now home to 140,000 Americans) as the 28th state of the union, regardless of Mexico's undeniable claim to the region.

This in itself would be sufficient pretext for war. Another likely cause, unadmitted, is President Polk's yearning for yet more of Mexico - rich California. And there is also an unresolved dispute over the boundary of Texas.

American and Mexican War: 1846-1848

The Americans in Texas claim that the southern boundary of their province is the Rio Grande. The Mexicans maintain that it is the Nueces river, more than 100 miles to the north. War breaks out in 1846 when President Polk sends an American army under Zachary Taylor into the disputed region, prompting the Mexicans to take the same step in retaliation.

Taylor makes little progress into northern Mexico beyond the city of Monterrey, which he captures in September 1846. During that winter Polk tries another tactic. He sends an American army under Winfield Scott by sea to the Gulf of Mexico.

In March 1847 Scott takes the port of Veracruz after a three-week siege. He then marches inland and defeats Santa Anna (once again serving as Mexico's president) at Cerro Gordo. Though strongly opposed in the mountainous terrain, he reaches Mexico City. He enters the capital in September.

The resulting treaty, signed in Guadalupe Hidalgo in 1848, gives Polk all that he has hoped for. In return for a payment of $15 million, Mexico cedes to the USA the territory now forming the states of New Mexico, Colorado, Utah, Nevada, Arizona and California. With suitable forethought, during the course of the war, US forces have already occupied the only developed parts of this vast region, New Mexico and California.

Reform and civil war: 1848-1861

In the aftermath of the humiliating capitulation to the United States, Mexico's politicians argue that drastic reforms are needed to save the republic. In this mood both liberals and conservatives gradually move to more extreme positions.

The conservatives are the first to seize control by force, in a coup of 1853. They then make the astonishing decision, in view of his record, of inviting Santa Anna to assume power as dictator. He proves so ineffectual that he is easily toppled in 1855 by a liberal rebellion, led by Juan Alvarez and Ignacio Comonfort. Together they launch a radical programme which becomes known simply as the Reform.

The central aim of the Reform is to transform Mexico into a secular democracy. This involves abolishing the special privileges enjoyed by the church and the military, together with the forced sale of all church lands not used for specifically religious purposes. A constitution putting in place a secular government is proclaimed in 1857. Comonfort is elected president.

The church fights back by excommunicating any official who takes the oath required by the new constitution. The result is the full-scale outbreak of the civil war which has been simmering for several years. The conservatives seize Mexico City in January 1858. Comonfort escapes into exile.

The closest ally of the liberal leaders Alvarez and Comonfort has been Benito Juárez, the most remarkable figure in Mexican history of this period. A full-blooded Indian, the son of Zapotec parents on both sides, he has begun his working life as a domestic servant before making a career as a lawyer and liberal revolutionary.

In 1858 he is chosen to succeed Comonfort as the legitimate president under the previous year's constitution. He maintains his government in Veracruz, the nation's main port, and in 1859 succeeds in winning the diplomatic support of the US president James Buchanan (Britain and France, by contrast, align themselves with the conservatives).

In 1860 the liberals begin to make extensive gains in the civil war, and on the first day of 1861 their army enters Mexico City. The conservative leaders, in their turn, flee into exile. Juárez is constitutionally elected president, but the nation which he now governs is bankrupt. To tackle the economic crisis he suspends for two years all interest payments on Mexico's massive foreign debt.

In doing so he plays into the hands of the European supporters of the conservative faction. Britain, France and Spain send a joint force to Mexico to protect their investments.

A tale of two emperors: 1862-1867

In January 1862 an army of 8500 French and Spanish troops and 700 British marines occupies the city of Veracruz. But within two months this European alliance falls apart, when it becomes evident that the allies have different intentions. Britain is mainly interested in using the customs collected at Veracruz to service the debt. French policy by contrast, following a grandiose notion of the emperor Napoleon III, envisages the conquest of Mexico and the establishment of a new Catholic empire in America.

In March, when the split becomes clear, the British and the Spanish embark for home. The French march inland.

The French forces meet stronger opposition than they expect (they are defeated in their first engagement against the Mexicans, at Puebla in May 1862), but with the help of reinforcements from France they have more success during 1863. In June they capture Mexico City. The Mexican president, Juárez, flees to the north of the country where he continues a military campaign against the French intervention.

With Mexico City in French hands, the central purpose of Napoleon III's plan can come into effect. A hastily convened conservative assembly is persuaded to declare Mexico an empire and to offer the crown to a European prince. The candidate has already been selected by Napoleon.

The unfortunate recipient of this poisoned chalice is the 31-year-old archduke Maximilian, a younger brother of the Austrian emperor Francis Joseph. Napoleon, who has recently gone to war in Italy to liberate the Austrian provinces there, now sees an advantage in a Franco-Austrian alliance.

Maximilian is one of history's tragic figures. Liberal, idealistic, courageous, naive, he is only persuaded to go to Mexico (after much deliberation) on the false assurance that the Mexicans have voted him the crown - and on the promise that the 33,000 French troops now on Mexican soil will not be withdrawn before his position is secure.

Maximilian and his young wife Carlota (originally Charlotte, daughter of Leopold I of Belgium) are crowned emperor and empress in June 1864 in the cathedral in Mexico City.

Maximilian sets about ruling as a liberal monarch. He retains the reforms brought in by Juárez. He refuses to restore church lands. He takes steps to improve the lot of Indian labourers on the great landed estates. He launches educational schemes, founds a national art gallery, plans public parks and shady avenues. But meanwhile his nation is at war. Juárez is unremitting in his determination to restore the Mexican republic. And real power at the centre is held not so much by Maximilian as by the commander of the French troops.

Two events in 1865 prove a turning point, one in Mexico and the other abroad. Maximilian is persuaded by the French commander to pass an emergency decree allowing for the summary court martial and execution of any members of unauthorized armed groups. And the American Civil War is brought to a close, enabling the US to pay belated attention to a blatant infringement of the Monroe Doctrine.

Under pressure from the secretary of state William H. Seward (and also from public opinion in France), Napoleon in 1866 orders the French troops to withdraw from Mexico. He expects Maximilian to come with them. But the idealistic young emperor considers it his duty to stay with his people.

Maximilian and his small army are soon surrounded at Querétaro. The emperor and his two leading generals are courtmartialled and condemned to death. In spite of numerous appeals for clemency arriving from Europe, Juárez upholds the sentence - partly in retaliation for Maximilian's harsh decree of 1865. The scene of the three men being shot has been immortalized in a painting by Manet.

This Mexican fiasco is but one staging post in the downfall of the French emperor, Napoleon III, who is himself deposed in 1870. But it leaves the Mexican liberals in a greatly strengthened position. The next four decades belong mainly to one of Juárez's chief lieutenants, Porfirio Díaz.

Juárez, Lerdo and Díaz: 1867-1911

Benito Juárez is re-elected president in 1867 and again in 1871. On this latter occasion the Liberal party splits three ways. Juárez is opposed by Sebastián Lerdo and Porfirio Díaz, two of his leading colleagues from the years of resistance. Juárez wins, but dies in office in the following year.

Lerdo succeeds him as president, but during the 1870s Díaz makes several attempts at rebellion. On his third bid, in 1876, he succeeds. Díaz defeats Lerdo's government forces at Tecoac in November, and in May 1877 is himself formally elected president. Apart from one short period (1880-84, when he hands the presidency to a trusted subordinate), Díaz remains in power until 1911.

Although emerging from the liberal tradition personified by Juárez, the taste of power transforms Díaz into a classic example of the Latin American caudíllo. He rules as a dictator, manipulating the press, imprisoning and sometimes assassinating political opponents, and changing the constitution to ensure that he can remain in office for an indefinite period on the basis of rigged elections every four years.

His economic policies do nothing to help Mexico's poor, but they have a beneficial effect on the economy as a whole. Foreign investment is encouraged. There are major developments in railways, mines, telegraphy, textile industries and eventually oil.

Inevitably the new wealth accumulates in the hands of the richer classes and of foreign companies. Agrarian problems are made worse after a law of 1894 allows public land to be sold cheaply with no limit on individual ownership. By the first decade of the new century the elderly Díaz (seventy in 1900) is imposing his erratic personal will on a nation seething with multiple and justified resentments.

The eventual reaction is sparked by an idealistic liberal, Francisco Madero, who stands against Díaz in the election of 1910. Madero is arrested just before polling begins. But he escapes and reaches Texas, where he issues a pamphlet demanding democracy. He even specifies a date for the revolution to begin - 20 November 1910.