The Treaty of San Germano was signed on 23 July 1230 at San Germano, present-day Cassino, ending the War of the Keys that had begun in 1228. The parties were Pope Gregory IX and Frederick II, king of Sicily and Holy Roman emperor. On 28 August at Ceprano, the peace was finalized with the readmission of the excommunicated Frederick into the church.
The negotiations for the treaty, initiated by Frederick, began in November 1229. The Lombard League, an ally of Gregory, objected to the process. The intercession of major German princes, especially Duke Leopold VI of Austria and Grand Master Hermann von Salza, was necessary to move things forward. The most important negotiator on the papal side was Cardinal Thomas of Capua, although Gregory's actual representative at the signing was Guala de Roniis.
In territorial terms, the treaty essentially restored the status quo ante bellum. Frederick recognized the Papal State and Gregory recognized Frederick as king of Sicily and emperor unimpaired. A general amnesty was issued. The biggest concession was Frederick's surrender of his special rights over the church in Sicily. Nevertheless, the treaty has often been regarded as a victory for the emperor.