In old times people say that Trevi ruled the valley below it, all the way to the Colli Martani, the line of mountains that run down the middle of Umbria. Trevi had a bishop until the 11th century, and was an important place belonging to the Lombards (in Italian, a "gastaldato"). At the beginning of the 13th century, Trevi made itself independent and became a free commune. It often fought on the side of Perugia to defend itself against nearby Spoleto, and fought wars with other communes in the area, winning some and losing some. It was invaded by Spoleto in the 14th century and by the Trinci, rulers of Foligno. In 1438 Trevi became part of the lands belonging to the Church as part of the "legation" of Perugia: after that Trevi's history was as part of the States of the Church, then (1860) of the united Kingdom of Italy.