The Roman Republic was the era of classical Roman civilization beginning with the overthrow of the Roman Kingdom, traditionally dated to 509 BC, ending in 27 BC with the establishment of the Roman Empire. It was during this period that Rome's control expanded from the city's immediate surroundings to hegemony over the entire Mediterranean world. Roman society under the Republic was a cultural mix of Latin and Greek elements, visible in the Roman Pantheon, its political organisation was influenced by the Greek city states of Magna Graecia, with collective and annual magistracies, overseen by a senate. The top magistrates were the two consuls, who had an extensive range of executive, judicial and religious powers. Whilst there were elections each year, the Republic was not a democracy, but an oligarchy, as a small number of large families monopolised the main magistracies. 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 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 indeed conquered the whole Italian peninsula in a century, which turned the Republic into a major power in the Mediterranean; the Republic's greatest enemy was doubtless Carthage, against. The Punic general Hannibal famously invaded Italy by crossing the Alps and inflicted on Rome two devastating defeats at the 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 embarked in a long series of difficult conquests, after having notably defeated Philip V and Perseus of Macedon, Antiochus III of the Seleucid Empire, the Lusitanian Viriathis, the Numidian Jugurtha, the great Pontic king Mithridates VI, the Gaul Vercingetorix, the Egyptian queen Cleopatra.
At home, the Republic 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 achieved political equality in several steps during the 4th century BC; 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 solve this issue, several social reformers, known as the Populares, tried to pass agrarian laws, but the Gracchi brothers, Saturninus, or Clodius Pulcher were all murdered by their opponents, the Optimates, keepers of the traditional aristocratic order. Mass slavery caused three Servile Wars. 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 Sulla dominated in turn the Republic. These multiple tensions lead to a series of civil wars. Despite his victory and appointment as dictator for life, Caesar was murdered in 44 BC. Caesar's heir Octavian and lieutenant Mark Antony defeated Caesar's assassins Brutus and Cassius in 42 BC, but turned against each other; the final defeat of Mark Antony and his ally Cleopatra at the Battle of Actium in 31 BC, the Senate's grant of extraordinary powers to Octavian as Augustus in 27 BC – which made him the first Roman emperor – thus ended the Republic. Since the foundation of Rome, its rulers had been monarchs, elected for life by the patrician noblemen who made up the Roman Senate; the last Roman king was Lucius Tarquinius Superbus. In the traditional histories, Tarquin was expelled in 509 because his son Sextus Tarquinius had raped the noblewoman Lucretia, who afterwards took her own life. Lucretia's father, her husband Lucius Tarquinius Collatinus, Tarquin's nephew Lucius Junius Brutus mustered support from the Senate and army, forced Tarquin into exile in Etruria.
The Senate agreed to abolish kingship. Most of the king's former functions were transferred to two consuls, who were elected to office for a term of one year; each consul had the capacity to act as a check on his colleague, if necessary through the same power of veto that the kings had held. If a consul abused his powers in office, he could be prosecuted. Brutus and Collatinus became Republican Rome's first consuls. Despite Collatinus' role in the creation of the Republic, he belonged to the same family as the former king, was forced to abdicate his office and leave Rome, he was replaced as co-consul by Publius Valerius Publicola. Most modern scholarship describes these events as the quasi-mythological detailing of an aristocratic coup within Tarquin's own family, not a popular revolution, they fit a narrative of a personal vengeance against a tyrant leading to his overthrow, common among Greek cities and theorised by Aristotle