The United States was unable to enforce the Monroe Doctrine during the Civil War years and several European powers contemplated dabbling in Western hemispheric affairs.
The most notable adventure was attributed to Napoleon III of France, who used the pretext of collecting overdue loans to Mexico to justify the invasion of that country. In truth, the French were really trying to recapture some of the grandeur of earlier Napoleonic times. They had support from conservative elements within Mexico, who had tired of the regular cycle of unrest and revolution.
The French forces suffered some embarrassing early defeats, but were able to occupy Mexico City in June 1863. They established a puppet government under Austro-Hungarian Archduke Fernando Maximilian, who was named emperor of Mexico in 1864.
Opposition from the previous government and liberal (or republican) forces plunged the country into general warfare. The insurgents in the north were led by Benito Juárez and those in the south by Porfirio Díaz. Both armies were repeatedly defeated by French forces, but managed to keep a presence in the field.
The United States opposed the European presence, but was distracted by its own turmoil. When the Civil War ended in 1865, Secretary of State William H. Seward turned up the diplomatic heat. The French, tiring of the financial drain more than fearing American disapproval, began withdrawing its forces. The French presence remained but was concentrated in the major cities; the warfare in the provinces was conducted by Mexicans hired for the imperial army. Those forces felt minimal loyalty to Maximilian and desertion rates were very high. Soldiers-of-fortune from all parts of the world were attracted to this conflict, including large numbers of American Civil War veterans.
Early in 1867, the remaining French soldiers withdrew; the empire collapsed almost immediately. Maximilian was captured, tried and executed in June on that year. His wife Carlotta was spared, but she drifted into insanity. Known as “Carlotta la Loca," she lived out her final years in a French asylum. In Mexico the government was taken over by Juárez, who held office until his death in 1872. Later Díaz would rule as a dictator for more than 30 years.
This incident impacted American history in an additional way. In the Hampton Roads Peace Conference of early 1865, the Confederate delegates used the French presence in Mexico as a major bargaining chip. They proposed that a joint military effort be mounted to drive the French from Mexico, but insisted that the Civil War be ended and the Confederacy be granted full recognition. Lincoln dismissed the matter in full.