Leo IV was elected on April 10, 847, three months after the death of Sergius II — at the moment of crisis following the Saracen sack of the apostolic basilicas of August 846.
His pontificate was dominated by the defensive reconstruction of Rome against the Saracen threat. Within months of his election, he organized the Christian naval coalition of Naples, Amalfi, and Gaeta that won the Battle of Ostia (849) — the Catholic naval victory at the mouth of the Tiber that decisively repulsed the second Saracen fleet that had returned to attempt the conquest of Rome itself.
Most between 847 and 852 Leo IV constructed the Leonine Wall — the massive defensive enceinte enclosing the extramural basilica of St. Peter, the Vatican palace, and the Vatican hill within a walled enclosure called from his name the Leonine City (Civitas Leonina). The Leonine Wall is the territorial-architectural origin of the modern Vatican City — the independent papal sovereign state that survives to this day as the Holy See's territorial jurisdiction.
He also extensively restored and re-consecrated the basilica of St. Peter (whose Saracen-damaged altar he re-consecrated), founded the Leoniana community of Lombard Catholic refugees at the future Borgo neighbourhood, and rebuilt the Aurelian walls. He held three Roman synods (850, 853, 854) on discipline and Carolingian-papal relations. He died on July 17, 855.

