In 49 BC, the last Republican civil war was initiated after Julius Caesar defied senatorial orders to disband his army following the conclusion of hostilities in Gaul. He crossed over the Rubicon river with the 13th Legion, a clear violation of Roman Law, and marched to Rome. The Optimates fled to Greece under the command of Pompey since they were incapable of defending the city of Rome itself against Caesar. Led by Caesar, the Populares followed, but were greatly outnumbered and defeated in the Battle of Dyrrhachium. Still outnumbered, Caesar recovered and went on to decisively defeat the Optimates under Pompey at Pharsalus. Pompey then fled to Egypt, where to Caesar's consternation, Pompey was assassinated. The remaining Optimates, not ready to give up fighting, clustered in the African provinces and organized a resistance. Its leaders were Marcus Cato (the younger) and Caecilius Metellus Scipio. Other key figures in the resistance were Titus Labienus, Publius Attius Varus, Lucius Afranius, Marcus Petreius and the brothers Sextus and Gnaeus Pompeius (Pompey's sons). King Juba I of Numidia was a valuable local ally. After the pacification of the Eastern provinces, and a short visit to Rome, Caesar followed his opponents to Africa and landed in Hadrumetum (modern Sousse, Tunisia) on December 28, 47 BC. After landing, Caesar's forces were engaged by the Optimates led by Petreius and Labienus, Scipio being absent. The result was ultimately indecisive and both sides retreated.
The Optimates gathered their forces to oppose Caesar with astonishing speed. Their army included 40,000 men (about 8 legions), a powerful cavalry force led by Caesar's former right-hand man, the talented Titus Labienus, forces of allied local kings and 60 war elephants. The two armies engaged in small skirmishes to gauge the strength of the opposing force, during which two legions switched to Caesar's side. Meanwhile, Caesar expected reinforcements from Sicily. In the beginning of February, Caesar arrived in Thapsus and besieged the city, blocking the southern entrance with three lines of fortifications. The Optimates, led by Metellus Scipio, could not risk the loss of this position and were forced to accept battle.