The French saw opportunity for conquest in the New World in Mexico. The Germans did too. It was widely believed that there was gold in Mexico. Pretty much everyone but the English were there! This is one of the reasons you will see light skinned, light haired, light eyed people in Mexico.
It was a neat little power play by Napoleon III. He signed a pack with the Spanish & UK (The Treaty of London) to make it a place to (steal) resources. The US was busy & by the time the others realized that France was going in to take everything, they thought better of fighting & split. There were many things going on at the time, The French & some Spanish felt that a new powerful Catholic Church needed to be established on the border because of the power of the Protestant churches in Texas, the French were trying to patch up a lot of things from prior wars, it was an interesting time.