The town has played a conspicuous part in military history: its fortifications date back to Roman times, and it has several traces of the period, including the 1st-century mausoleum of the Roman general Lucius Munatius Plancus at the top of the Monte Orlando.
Gaeta's fortifications were extended and strengthened in the 15th century, especially throughout the history of the Kingdom of Naples (later the Two Sicilies). Present day Gaeta is a fishing and oil seaport, and a renowned tourist resort. NATO maintains a Naval base of operations at Gaeta.
It is the ancient 'Caieta', situated on the slopes of the Torre di Orlando, a promontory overlooking the Mediterranean Sea. Gaeta was an ancient Ionian colony of the Samians according to Strabo, who believed the name stemmed from the Greek kaiétas, which means "cave", probably referring to the several harbours. According to Virgil's Aeneid (vii.1–9), Caieta was Aeneas’ (another legend says Ascanius') wet-nurse, whom he buried here.
In the classical age Caieta, famous for its lovely and temperate climate, like the neighbouring Formia and Sperlonga, was a tourist resort and site of the seaside villas of many important and rich characters of Rome. Like the other Roman resorts, Caieta was linked to the capital of the Empire by Via Appia and its end trunk Via Flacca (or Valeria), through an opposite diverticulum or bye-road. Its port was of great importance in trade and in war, and was restored under Emperor Antoninus Pius. Among its antiquities is the mausoleum of Lucius Munatius Plancus.
At the beginning of the Middle Ages, after the Lombard invasion, Gaeta remained under suzerainty of the Byzantine Empire. In the following years, like Amalfi, Sorrento and Naples, it would seem to have established itself as a practically independent port and to have carried on a thriving trade with the Levant.
As Byzantine influence declined in Southern Italy the town began to grow. For fear of the Saracens, in 840 the inhabitants of the neighbouring Formiæ fled to Gaeta. Though under the suzerainty of Byzantium, Gaeta had then, like nearby ports Naples and Amalfi, a republican form of government with a dux ("duke", or commanding lord under the command of the Byzantine Exarch of Ravenna), as a strong bulwark against Saracen invasion.
Around 830, it became a lordship ruled by hereditary hypati, or consuls: the first of these was Constantine (839–866), who in 847 aided Pope Leo IV in the naval fight at Ostia. At this same time (846) the episcopal see of Gaeta was founded when Constantine, Bishop of Formiae, fled thither and established his residence. He was associated with his son Marinus I. They were probably violently overthrown (they disappear suddenly from history) in 866 or 867 by Docibilis I, who, looking rather to local safety, entered into treaties with the Saracens and abandoned friendly relations with the papacy. Nevertheless, he greatly expanded the duchy and began construction of the palace. Greatest of the hypati was possibly John I, who helped crush the Saracens at Garigliano in 915 and gained the title of patricius from the Byzantine Emperor Constantine VII.
The principle of co-regency governed the early dynasties: Docibilis associated John with him and John in turn associated his son Docibilis II with him. In 933, three generations were briefly co-ruling: John I, Docibilis II, and John II. On the death of Docibilis II (954), who first took the title dux, the duchy passed from its golden age and entered a decline marked by a division of territory. John II ruled Gaeta and his brother, Marinus, ruled Fondi with the equivalent title of duke. Outlying lands and castles were given away to younger sons and thus the family of the Docibili slowly declined after mid-century.
Allegedly, but improbably, from the end of the 9th century, the principality of Capua claimed Gaeta as a courtesy title for the younger son of its ruling prince. In the mid-10th century, the De Ceremoniis of Constantine VII Porphyrogenitus lists the ceremonial title "prince of Gaeta" among the protocols for letters written to foreigners.
Prince Pandulf IV of Capua captured Gaeta in 1032 and deposed Duke John V, assuming the ducal and consular titles. In 1038, Prince Guaimar IV of Salerno took it from him and, in 1041, established the Norman counts of Aversa, who were afterwards princes of Capua, as puppet dukes. The native dynasty made a last attempt to wrest the duchy from Guaimar in 1042 under Leo the Usurper.
In 1045, the Gaetans elected their own Lombard duke, Atenulf I. His son, Atenulf II, was made to submit to the Norman Prince Richard I of Capua in 1062, when Gaeta was captured by Jordan Drengot. In 1064, the city was placed under a line of puppet dukes, appointed by the Capuan princes, who had usurped the ducal and consular titles. These dukes, usually Italianate Normans, ruled Gaeta with some level of independence until the death of Richard of Caleno in 1140. In that year, Gaeta was definitively annexed to the Kingdom of Sicily by Roger II, who bestowed on his son Roger of Apulia, who was duly elected by the nobles of the city. The town did maintain its own coinage until as late as 1229, after the Normans had been superseded by the centralising Hohenstaufen.
In the many wars for possession of the Kingdom of the Two Sicilies, Gaeta, owing to its important strategic position, was often attacked and defended bravely. In 1194 the Pisans, allies of Emperor Henry VI in the conquest of the kingdom, took possession of the city and held it as their own.
In 1227 the Hohenstaufen Emperor Frederick II was in the city and strengthened the castle. However, in the struggle between Emperor Frederick and the Papacy, in 1228 it rebelled against Frederick II and surrendered to the pope, after the Papal forces destroyed the imperial castle in the fray. After the peace of San Germano of 1230, it was given back to the Sicilian kingdom. In 1233, Frederick regained control of the important port and fortress. In 1279 Charles I of Anjou rebuilt the castle and enhanced the fortifications. In 1289 King James II of Aragon besieged the city in vain. From 1378 Gaeta hosted for some years antipope Clement VII. The future King of Naples Ladislaus lived in Gaeta from 1387. Here, on 21 September, he married Costanza Chiaramonte, whom he repudiated three years later.
King Alfonso V of Aragon (as Alfonso I of Naples) made Gaeta his beachhead for the conquest of the Kingdom of Naples in 1435, besieged it, and to his own disadvantage displayed great generosity, by aiding those unable to bear arms who had been driven out from the besieged town. After a disastrous naval battle he captured it, and gained control of the kingdom. He enlarged the castle, which became his royal palace, and created a mint. In 1451 the city was home to the Treaty of Gaeta, stipulated between Alfonso V and the Albanian lord, Skanderbeg: the treaty ensured protection of the Albanian lands in exchange for political suzerainty of Skanderbeg to Alfonso.
In 1495, king Charles VIII of France conquered the city and sacked it. The following year, however, Frederick I of Aragon regained it with a tremendous siege which lasted from 8 September to 18 November.
In 1528 Andrea Doria, admiral of Charles V, defeated a French fleet in the waters off Gaeta and gave the city to its emperor. Gaeta was thenceforth protected with a new and more extensive wall, which also encompassed Monte Orlando.
In the War of the Spanish Succession, on 30 September 1707 Gaeta was stormed and taken after a three-month siege by the Austrians under General Daun. On 6 August 1734 it was taken by French, Spanish and Sardinian troops under the future King Charles of Naples after a stubborn defense by the Austrian viceroy of four months. Charles' own daughter Infanta Maria Josefa of Spain was born here in 1744. The fortifications were again strengthened; and in 1799 it was temporarily occupied by the French.
On 18 July 1806 it was captured by the French under André Masséna, after an heroic defence. It was created a duché grand-fief in the Napoleonic Kingdom of Naples, but under the French name Gaete, for finance minister Martin-Michel-Charles Gaudin, in 1809 (family extinguished in 1841).
On 8 August 1815 it capitulated to the Austrians after a three months' siege. It had been attacked and partially reduced by ships of the Royal Navy on 24 July 1815.
Finally, in 1860, it was the scene of the last stand of Francis II of the Two Sicilies against the forces of United Italy. The king offered a stubborn defense, shut up in the fortress with 12,000 men and inspired by the heroic example of Queen Maria Sophie after Garibaldi's occupation of Naples. It was not until 13 February 1861 that Francis II was forced to capitulate when the withdrawal of the French fleet made bombardment from the sea possible, thus sealing the annexation of the Kingdom of Naples to the Kingdom of Italy. Cialdini, the Piedmontese general, received the victory title of Duke of Gaeta. Gaeta was the center for the Montenegrin rebels that opposed the unification of Yugoslavia, The Greens, 1919-1924.
After the Risorgimento and until World War II, Gaeta grew in importance and wealth as a seaport. The nearby town of Elena, separated after the Risorgimento and named after the queen of Italy, was reunited to Gaeta following World War I. Mussolini transferred Gaeta from the southern region known today as Campania (formerly Terra di Lavoro, to which it is historically and culturally attached) to the central region of Lazio.
In April 1938 Gaeta was the scene of an extraterritorial vote of German and Austrian clerics, studying at the German college of Santa Maria dell'Anima, on the question of the German annexation of Austria ("Anschluss"). The place of the vote was the German heavy cruiser Admiral Scheer, which anchored in the harbour of Gaeta. In contrary to the overall German result, these clerical votes rejected the Anschluss with over 90%, an incident which was coined as "Shame of Gaeta" (Vergogna di Gaeta, Schande von Gaeta) at the time.
After the king dismissed Mussolini in the summer of 1943, the latter was initially taken via Gaeta to the island prison of Ponza. After Italy surrendered to the Allies, however, the town's fortunes began to decline. Recognizing its strategic importance, and fearful of an Allied landing in the area, German troops occupied the city and expelled most of the population. The zone of exclusion began with a five-kilometre border from the historical city centre. Soon after, however, the population was expelled even beyond this point. The Gaetani were finally ordered to leave the area completely. Those who could not were placed in a concentration camp, and a few were taken to Germany.
Following the Allied advance across the Garigliano and the Allied occupation of Rome, the Gaetani were allowed to return to their city and begin the process of rebuilding. In subsequent decades the city has boomed as a beach resort, and it has seen some success at marketing its agricultural products, primarily its tomatoes and olives. Many of its families count seamen among their number. However, the decades since World War II have been as difficult for Gaeta as they have been for most of Italy's Mezzogiorno. In particular, its importance as a passenger seaport has nearly vanished: ferries to Ponza and elsewhere now leave from the nearby town of Formia. All attempts to build a permanent industry as a source of employment and economic well-being for the town have failed. Notable losses include the Littorina rail line (now used as a parking lot and a marketplace), the AGIP refinery (nowadays a simple depot), and the once-thriving glass factory, which has become an unused industrial relic.
Gaeta does have a viable tourism industry, as it is a popular seaside resort. Its warm, rain-free summers attract people to its numerous beaches along the coastline, such as Serapo and Sant'Agostino Beaches. Nearly equidistant to both Naples and Rome, Gaeta is a popular summer tourist destination for people from both cities' metropolitan areas.