The origin of the religious establishment was due to the initiative of the Lateran Canons, who received approval for its construction from Pope Sixtus IV in 1473.

The church was begun in 1477. Elevated to an abbacy in 1628, the complex underwent a period of decline due to the suppression of the Lateran Order in the late 1700s, followed by the Napoleonic expropriations. The buildings, used as stables and a barracks, were recovered in 1830, when the church was acquired by the parishioners of the district of San Martino.

Restoration work from the 1930s to the 1970s recovered the original appearance of the 15th-century Lombard architecture and brought to light the interior decoration of the nave, in classicist style, dating from the late 15th century.

Other frescoes on the walls and in the chapels are examples of early 16th century painting and are not part of the same decorative campaign.

A room identified as the ancient private chapel of the canons contains traces of a frescoed lunette with the Madonna and child with Saints and Blesseds of the Lateran order.

The adjacent Santa Maria Delle Grazie convent, arranged around a Bramante-style cloister, was used as a hospice for the poor and disabled from 1833, thanks to a testamentary bequest by Gaudenzio de Pagave.

The renovation of the building was entrusted to the architect Antonio Agnelli (1788-1865).