History
Anagni was an important city and spiritual centre of the Hernici, until the Romans attacked and defeated it in 306 BC.
In Imperial times, many emperors used to spend their summers in Anagni to escape the heat of Rome, the most notable ones being Marcus Aurelius, Septimius Severus, Commodus, and Caracalla. By the end of the Roman Empire, a deep political and economic crisis caused the demographic collapse of Anagni's population.
During the 10th and the 11th centuries, the popes began to consider it a safer and healthier spot compared to Rome, which was the place of frequent epidemic diseases. For this reason, Anagni became one of the favourite residences of the popes, in the 12th and 13th centuries. As a result, several events connected with the struggle between Papacy and Empire took place in the city, including some of the most important political events in these two centuries.
In 1160, Alexander III excommunicated the Emperor Frederick Barbarossa in the Cathedral; in 1176, after the Battle of Legnano, the same pope received the imperial legates, with whom he elaborated the Pactum Anagninum ("Anagni's Agreement"), premise to the peace, which was achieved in Venice in 1177.
The 13th century represented the real golden period of the city. Innocent III (1198–1216), was one of the outstanding personalities of his century, together with Frederick II, of whom he favoured the coronation as Emperor of Germany, and Saint Francis of whom he approved the first Rule.
On September 29, 1227 Gregory IX excommunicated Emperor Frederick II, who had abandoned the Crusade that the Emperor himself had proclaimed. In September 1230, after the reconciliation, Gregory IX received Frederick II in Anagni, who in the meantime had been able to conquer both Jerusalem and Nazareth.
The name of Anagni is particularly connected to the events of Pope Boniface VIII. In 1300 Boniface VIII, at the summit of his pontificate, set up the first Jubilee and founded the first Roman university. Having got into a violent conflict with the King of France, Philip the Fair, who assigned himself the right to tax the French clergy, Boniface VIII emanated the famous Bull "Unam Sanctam" of 1302, which arrogated to the Pope's absolute supremacy over earthly power, against the king. The dispute became so harsh that Philip the Fair organized an expedition to arrest the Pope, with the purpose of removing Boniface from his office by the help of a general council.
On 7 September 1303, the king's advisor Guillaume de Nogaret and Sciarra Colonna led a band of 2,000 mercenaries on horse and foot. They joined locals in an attack on the palaces of the Pope and his nephew at the papal residence at Anagni, the notorious 'Outrage of Anagni'. The palace was plundered and Boniface was nearly killed (Nogaret prevented Sciarra Colonna from murdering the Pope). Still, Boniface was subjected to harassment and held prisoner for three days during which no one brought him food or drink. The townsfolk eventually expelled the marauders, and Boniface pardoned those captured. He returned to Rome on 13 September 1303.
According to a legend, in such circumstances the Pope was slapped by Sciarra Colonna with his gauntlet: the episode was, therefore, remembered in Italian History as the "Schiaffo di Anagni" (Anagni's Slap). The outrageous imprisonment of the Pope inspired Dante Alighieri in a famous passage of his Divine Comedy (Purgatory, XX, vv. 85-93), the new Pilate has imprisoned the Vicar of Christ.
After the death of Boniface VIII, the splendor of Anagni collapsed. The transfer of the papal court to Avignon marked for the city the beginning of a long period of decline, which lasted through the entire 15th century. The town was sacked by the troops of Duke Werner von Urslingen in 1348, becoming ruined and depopulated.
Anagni was also the summer residence of the popes until recently. It was similar to what Castel Gandolfo in the Alban Hills is to today's popes.

See
• The Cathedral of Anagni, dedicated to Saint Mary, in Romanesque style, was constructed during the years 1071-1105, with Gothic-style additions in the mid-13th century. The most noteworthy part of the Cathedral is its crypt, which contains the tomb of Saint Magnus of Anagni, the patron saint of Anagni, and Saint Secundina of Anagni. The frescoes covering all the walls and ceiling are some of the best works of Romanesque/Byzantine art in Italy, and form a single iconographic scheme, which includes natural philosophy, saints, the Apocalypse, and the Old Testament Ark of the Covenant.
• The Papal Palace (or Boniface VIII's Palace), the scene of the famous "slap".
• The Communal Palace, built by the architect Jacopo da Iseo in 1163. It is made up of two pre-existing edifices connected by a portico supporting the large Sala della Ragione ("Reason Hall"). The façade sports the coat of arms of the Orsini and Caetani families.