Roman-Gaulish Wars: Battle of the Allia: A Roman army is defeated by raiding Gauls, leading to the subsequent sacking of Rome.

The Battle of the Allia was a battle fought c.387 BC between the Senones a Gallic tribe led by Brennus, who had invaded Northern Italy and the Roman Republic. The battle was fought at the confluence of the Tiber and Allia rivers, 11 Roman miles (16 km, 10 mi) north of Rome. The Romans were routed and subsequently Rome was sacked by the Senones. According to scholar Piero Treves, "the absence of any archaeological evidence for a destruction-level of this date suggests that [this] sack of Rome was superficial only."The date of the battle has been traditionally given as 390 BC in the Varronian chronology, based on an account of the battle by the Roman historian Livy. Plutarch noted that the battle took place "just after the summer solstice when the moon was near the full [...] a little more than three hundred and sixty years from the founding [of Rome]," or shortly after 393 BC. The Greek historian Polybius used a Greek dating system to derive the year as having taken place in 387 BC, which is the most probable. Tacitus listed the date as 18 July.

The Roman Republic (Latin: Rēs pūblica Rōmāna [ˈreːs ˈpuːblika roːˈmaːna]) was a state of the classical Roman civilization, run through public representation of the Roman people. Beginning with the overthrow of the Roman Kingdom (traditionally dated to 509 BC) and ending in 27 BC with the establishment of the Roman Empire, Rome's control rapidly expanded during this period—from the city's immediate surroundings to hegemony over the entire Mediterranean world.

Roman society under the Republic was primarily a cultural mix of Latin and Etruscan societies, as well as of Sabine, Oscan, and Greek cultural elements, which is especially visible in the Roman Pantheon. Its political organization developed, at around the same time as direct democracy in Ancient Greece, with collective and annual magistracies, overseen by a senate. The top magistrates were the two consuls, who had an extensive range of executive, legislative, judicial, military, and religious powers. Even though a small number of powerful families (called gentes) monopolised the main magistracies, the Roman Republic is generally considered one of the earliest examples of representative democracy. Roman institutions underwent considerable changes throughout the Republic to adapt to the difficulties it faced, such as the creation of promagistracies to rule its conquered provinces, or the composition of the senate.

Unlike the Pax Romana of the Roman Empire, the Republic was in a state of quasi-perpetual war throughout its existence. Its first enemies were its Latin and Etruscan neighbours as well as the Gauls, who even sacked the city in 387 BC. The Republic nonetheless demonstrated extreme resilience and always managed to overcome its losses, however catastrophic. After the Gallic Sack, Rome conquered the whole Italian peninsula in a century, which turned the Republic into a major power in the Mediterranean. The Republic's greatest strategic rival was Carthage, against which it waged three wars. The Punic general Hannibal famously invaded Italy by crossing the Alps and inflicted on Rome two devastating defeats at Lake Trasimene and Cannae, but the Republic once again recovered and won the war thanks to Scipio Africanus at the Battle of Zama in 202 BC. With Carthage defeated, Rome became the dominant power of the ancient Mediterranean world. It then embarked on a long series of difficult conquests, after having notably defeated Philip V and Perseus of Macedon, Antiochus III of the Seleucid Empire, the Lusitanian Viriathus, the Numidian Jugurtha, the Pontic king Mithridates VI, the Gaul Vercingetorix, and the Egyptian queen Cleopatra.

At home, the Republic similarly experienced a long streak of social and political crises, which ended in several violent civil wars. At first, the Conflict of the Orders opposed the patricians, the closed oligarchic elite, to the far more numerous plebs, who finally achieved political equality in several steps during the 4th century BC. Later, the vast conquests of the Republic disrupted its society, as the immense influx of slaves they brought enriched the aristocracy, but ruined the peasantry and urban workers. In order to address this issue, several social reformers, known as the Populares, tried to pass agrarian laws, but the Gracchi brothers, Saturninus, and Clodius Pulcher were all murdered by their opponents, the Optimates, keepers of the traditional aristocratic order. Mass slavery also caused three Servile Wars; the last of them was led by Spartacus, an escaped gladiator who ravaged Italy and left Rome powerless until his defeat in 71 BC. In this context, the last decades of the Republic were marked by the rise of great generals, who exploited their military conquests and the factional situation in Rome to gain control of the political system. Marius (between 105 and 86 BC), then Sulla (between 82 and 78 BC) dominated in turn the Republic; both used extraordinary powers to purge their opponents.

These multiple tensions led to a series of civil wars; the first between the two generals Julius Caesar and Pompey. Despite his victory and appointment as dictator for life, Caesar was assassinated in 44 BC. Caesar's heir Octavian and lieutenant Mark Antony defeated Caesar's assassins Brutus and Cassius in 42 BC, but then turned against each other. The final defeat of Mark Antony alongside his ally and lover Cleopatra at the Battle of Actium in 31 BC, and the Senate's grant of extraordinary powers to Octavian as Augustus in 27 BC – which effectively made him the first Roman emperor – thus ended the Republic.