Gallieni was born 1849. In 1867 he began attending the Berthier Military Academy, and in 1869 he graduated with the rank of second lieutenant. Upon graduation he spent six months serving with the garrison at Boulogne before being sent to Indochina. He spent the next seven years there, working his way through the ranks, and becoming a captain by 1875. In 1876 he was posted to Guyana to form part of the penal colony guard, but contracted malaria within a month and was forced to return to France.
Gallieni was struck particularly hard by the disease and it was not until 1877 that he recovered. When he did return to active duty he was immediately packed off to Tunisia, to fight an attempted nationalist uprising, but by the time he arrived the uprising had been crushed. He remained with the Tunis Garrison for another four years, In 1881 he formed part of a military column consisting of 800 soldiers who marched from Tunis to Alexandria. Only 500 men arrived in Alexandria, with some getting separated from the main force, and others simply dying of exhaustion.
At the same time he had been marching across Africa, the Mahdi had declared Sudanese independence from the Egyptian kingdom (which had been under French protection since 1815), and an army under General Negrier was being formed in Egypt to crush the rebellion. Gallieni was given the temporary rank of Colonel and given command of a column. He fought during the battles of the campaign of 1883, and was made a full colonel following the victory at El Obeid.
When Negrier's army advanced into Khartoum in March 1884, Gallieni was asked to command the rearguard. As such he did not take part in the first battle of Omdurman. Following the Mahdist forces surrounding the french army in Khartoum, Gallieni kept a narrow corridor open, allowing around one-fifth of the French army to escape encirclement. Gallieni then withdrew his forces 50 miles north, to escape Mahdist attack.
He then waited for six weeks, whilst reinforcements arrived from the north, before launching an attack on the Mahdist forces. However he was hopelessly outnumbered. His forces remained near Khartoum until the garrison was completely overwhelmed in January 1885.
For his brave actions in attempting to relieve the siege Gallieni was promoted to general de division and appointed commander of the army of Sudan. He built up his forces from the 12,000 strong core of 1st Omdurman veterans, to a force of 60,000 troops organised into three divisions, and consisting of experienced colonial troops from across the empire.
After several skirmishes in 1885, Gallieni led the invasion into Sudan in March 1886. Within 4 weeks Gallieni had crushed the Mahdist armies and had forced the Mahdi to flee into the desert. Following this victory he was made military governor of Sudan.
Gallieni remained in Sudan, despite calls for him to be made chief of staff (despite being only 36). In 1898 another Sudanese nationalist uprising occurred, led by a man claiming to be the Mahdi. Gallieni had only 20,000 men under his command, meanwhile the rebels were nearly 80,000. Gallieni was able to draw the Mahdist forces toward Khartoum, making them think they could repeat their performance in 1884. However, Gallieni laid a trap, getting them to advance and ambushing them at Omdurman. He destroyed the Mahdist forces, leaving barely 1000 of them to escape the battle.
After this stunning victory Gallieni was instantly given command of the army of Flanders, and awarded the legion d'honour. Gallieni became a powerful voice in advocating stratigic planning, and in 1910 he was appointed chief of staff.
His priority was the reorganisation of the French metrapolitan army, prioritising it over the french colonial forces. He was appalled by the reactionary rhetoric of the inspector general, Marshal Phillipe Bonaparte, and was not surprised when he was assassinated. Gallieni tried to avoid war, arguing that even if France did defeat Prussia it would anger the other European nations so much that the empire wouldn't have the respect to remain dominant.