In 216 B.C., the Roman Republic was embroiled in the second of what would eventually be three devastating wars with the North African city-state of Carthage. What had begun some 50 years earlier as a territorial dispute had devolved into an existential duel, with both powers vying for supremacy. Rome had emerged the victors in the First Punic War, but at the start of the second conflict in 218 B.C., the Carthaginian general Hannibal had staged an audacious invasion of Italy via the Alps. Since then, his mercenary army of Libyans, Numidians, Spaniards and Celts had rampaged across the countryside, laying waste to farmland and trouncing Roman legions. In just two major battles at the River Trebia and Lake Trasimene, Hannibal had used his military genius to inflict as many as 50,000 casualties on the Romans.

Following these early losses, Rome adopted a delaying strategy that sought to cut off Hannibal’s supply lines and avoid the pitched battles that were his stock-in-trade. It was a canny tactic, but one the hyper-aggressive Romans would not embrace for long. In 216 B.C., they elected Gaius Terentius Varro and Lucius Aemilius Paullus as co-consuls and equipped them with eight legions—the largest army in the Republic’s history. Its mission was clear: confront Hannibal’s army and crush it.

The chance for a showdown arrived later that summer, when Hannibal marched into southern Italy and seized a vital supply depot near the town of Cannae. Varro and Paullus gave chase, and by early August the Romans and Carthaginians were both deployed along the River Aufidus. According to the ancient historian Polybius, Hannibal had around 40,000 infantry and 10,000 cavalry at his disposal (his famous war elephants had all died by 216). The Romans boasted some 80,000 troops and 6,000 cavalry.

On the morning of August 2, the two armies assembled on a hot, dust-blown plain and prepared for battle. The Romans set up in a traditional block formation with a mass of infantry protected by cavalry on both wings. Varro—the commander on the day—hoped to use his legions like a battering ram to break the center of the Carthaginian lines. Hannibal expected this, so he arranged his army in an unconventional formation designed to use the Romans’ momentum against them. He began by positioning his weakest troops—his Gallic Celts and Spaniards—at the very center of his line. He then placed his more elite, battle-hardened Libyan infantry slightly to the rear on both flanks. The cavalry took up positions on the far left and right wings. When fully assembled, the Carthaginian line resembled a long crescent that bulged outward at its center toward the Romans. Never one to lead from the rear, Hannibal assumed a post at the front alongside his Spaniards and Gauls.

At the sound of trumpets, the two sides surged forward and the battle commenced. “Now began a great slaughter and a great struggle,” the historian Appian later wrote, “each side contending valiantly.” Light infantry initiated the fight by probing one another’s lines and hurling javelins, spears and projectiles. The first decisive maneuver followed when Hannibal’s heavy cavalry, under the command of an officer named Hasdrubal, stampeded into the horsemen on the Romans’ right flank. In short order, the superior Carthaginian riders had all but obliterated their Roman adversaries.

Back at the infantry battle, Hannibal’s bare-chested Gauls and Spaniards collided with the main body of Romans in a whirlwind of swords, spears and shields. As the troops slashed and stabbed at one another, the Carthaginian center was slowly pushed back, reversing its formation from an outward bulge into a concave pocket. This was all part of Hannibal’s plan. By giving the Romans the impression they were winning, he was only luring them into a space between the still-unengaged Libyan troops on the edges of his formation. With their spirits soaring, thousands of legionaries had soon streamed into the pocket in the Carthaginian line. When they did, they abandoned their orderly shape and became bunched together.

Hannibal now gave the order that would spell the Romans’ doom. At his signal, the Libyans pivoted inward and attacked the advancing legionaries’ left and right flanks, closing them in a vise. Hasdrubal, meanwhile, galloped across the battlefield and helped rout the cavalry on the Romans’ left wing. Having shorn the Romans of their mounted support, he then wheeled his force around and pounced on the legionaries’ unprotected rear. The surviving Romans—perhaps as many as 70,000 men—were totally encircled.

Hannibal’s trap was complete, but the battle was still far from over. The corralled legionaries showed no signs of surrender, so the Carthaginians closed in and began the grisly work of cutting them down one man at a time. Over the next several hours, the plain at Cannae turned into a killing field. A few thousand Romans broke out of the encirclement and fled, but with no room to maneuver, the rest were slowly hemmed in and slaughtered. “Some were discovered lying there alive, with thighs and tendons slashed, baring their necks and throats and bidding their conquerors drain the remnant of their blood,” the chronicler Livy later wrote. “Others were found with their heads buried in holes dug in the ground. They had apparently made these pits for themselves, and heaping the dirt over their faces shut off their breath.” Ancient sources differ, but by sunset, anywhere from 50,000 to 70,000 Romans lay dead and thousand of others were captured. Hannibal had lost some 6,000 men.

HISTORY Vault: Colosseum

The Roman Empire is vividly brought to life through the lens of the Colosseum.

Word of the massacre at Cannae sent the city of Rome spiraling into a panic. “Multitudes thronged the streets,” Appian wrote, “uttering lamentations for their relatives, calling on them by name, and bewailing their own fate as soon to fall into the enemy’s hands.” In their desperation, the Romans dispatched a senator to the Greek oracle at Delphi to divine the meaning of the tragedy. They even conducted human sacrifices to appease the gods. While Hannibal ultimately decided that his army was too weak to march on Rome, Cannae had still pushed the Republic to the brink of collapse. In just one day of fighting, the Romans had lost at least seven times as many soldiers as were later killed at Battle of Gettysburg. “Certainly there is no other nation that would not have succumbed beneath such a weight of calamity,” Livy wrote.

Yet even in their darkest hour, the stubborn Romans simply refused to yield. Following a brief period of mourning, Rome’s senate rejected Hannibal’s peace offers and refused to ransom his Cannae prisoners. The citizenry was put to work making new arms and projectiles, and the crippled army was rebuilt by lowering the recruitment age, enlisting convicts and even offering slaves their freedom in exchange for service. For each of the Roman legions destroyed at Cannae, several more were eventually raised and committed to the field.

While his enemy fell back on its overwhelming manpower, Hannibal only grew weaker. He continued to maraud through Italy for several years in search of a second Cannae, but his isolated army slowly withered away after not enough of Rome’s allies rallied to his cause. The Romans’ miraculous comeback continued in 204 B.C., when the general later known as Scipio Africanus launched an invasion of North Africa with some 26,000 men, many of them survivors of the humiliation at Cannae. Hannibal was recalled from Italy to defend the Carthaginian homeland, but in 202, Scipio decisively defeated him in the war’s final clash at the Battle of Zama.

The Second Punic War effectively ended Carthage’s reign as a military power, allowing Rome to tighten its grip on the Mediterranean and begin building its empire. Even in defeat, however, Hannibal had cemented his place in the pantheon of great military commanders. The Romans built statues of him to celebrate their triumph over a worthy adversary, and his victory at Cannae later became a subject of fascination for generals ranging from Napoleon to Frederick the Great. Dwight D. Eisenhower described it as the “classic example” of a battle of annihilation. Nevertheless, Hannibal’s tactical masterpiece had not been enough to break the Romans. He had won a legendary battle at Cannae, only to leave his enemy even more determined to win the war.