The village is named after St Leo, its patron saint.
The slab of rock holding it up lends its name to the whole area – the Montefeltro, from the Latin Mons Feretri, a Roman settlement built around a temple to Jupiter Feretrius (tradition has it that the temple is under the contemporary cathedral.)
In the Middle Ages, it was fought over by the Byzantines, Goths, Franks and Longobards, becoming the capital of Berengar II’s kingdom in the mid 10th century.
The Malatesta of Rimini and their fierce foes, the Montefeltro of Urbino, snatched it from one another in the 13th and 14th centuries; the Montefeltro finally prevailed in 1441 through Duke Federico.
San Leo was part of the Marche region until 15 August 2009, when it joined Rimini province along with six other municipalities in the High Valmarecchia area after a referendum.