Following the Second Opium War, the French government of Napoleon III, with the help of Spanish and Filipino troops arriving from the Philippines (which was a Spanish colony at the time), decided to take over the southern part of Vietnam.
Napoleon III was instrumental in establishing the stronger French presence in the region. In 1858, the emperor approved a naval operation under Rigault de Genouilly and composed of French and Spanish soldiers, initially said to provide security for Catholic missionaries there after the execution of fray Jose María Díaz Sanjurjo. The operation escalated, and by 1861, it had turned into an invasion led by Admiral Léonard Charner. By 1862, hostilities ceased and in the following negotiations Vietnam was forced to cede three provinces to the French. This eventually became French Cochinchina.
French Cochinchina opened three major ports for essentially unrestricted French trade and allowed French navy ships free passage to Cambodia. Although French Cochinchina also gave French missionaries free rein, it did not stop hostilities between the Vietnamese and the Christian missionaries as well as their Vietnamese converts.
On September 1, 1858, France occupied Đà Nẵng (Tourane). On 18 February 1859, they conquered Saigon and three southern Vietnamese provinces: Biên Hòa, Gia Định and Đinh Tường; on 13 April 1862, the Vietnamese monarchic government was forced to cede them to France as part of the Treaty of Saigon.
In 1867, French authorities claimed that Emperor Tự Đức was not abiding by the treaty and that he was secretly supporting Vietnamese guerrillas who were trying to drive the French out of the three provinces. They used this to justify another attack to gain three more provinces. The provinces of Châu Đốc, Hà Tiên and Vĩnh Long were added to French controlled territory. In 1874, all the French territories in southern Vietnam were declared to be the new French colony of Cochinchina.