Perugia was an Umbrian settlement before it became one of the twelve cities of the Etruscan league, and it first shows up in writing as Perusia. A Roman account of a campaign in 310 or 309 BC mentions it. By 295 BC it had joined the Third Samnite War on the losing side and had to ask for peace. You can still walk through that city's gates: the Porta Marzia dates from the 3rd century BC, and the Etruscan Arch keeps its Roman additions.
Rome came for it in 41 BC. Lucius Antonius took refuge in the city, Octavian besieged it, and its senators were sent to their deaths. Slingers' lead bullets have turned up nearby, and everything burned except the temples of Vulcan and Juno. It was rebuilt quickly, since statue bases carry the words Augusto sacr(um) Perusia restituta. It became a Roman colony between 251 and 253 AD.
In 547 Totila and his Ostrogoths took the city after a long siege and laid it waste. Perugia had been the only city in Umbria to resist them. The bishop, Herculanus, spoke for the townspeople, and Totila is said to have ordered him flayed and beheaded. Herculanus became the patron saint, and the 14th century church of Sant'Ercolano, shaped like a polygonal tower, carries his name.
By the 11th century Perugia was a commune acting for itself, and it spent centuries at war with its neighbours, Foligno, Assisi, Spoleto, Todi, Siena and Arezzo among them. In 1186 the future emperor Henry VI recognised its consular government. Popes sheltered here from the turmoil of Rome, and five conclaves met in the city, including those that chose Honorius III in 1216, Clement IV in 1265, Celestine V in 1294 and Clement V in 1305. The city never accepted papal rule. It was excommunicated in 1282 for attacking the Ghibellines against a papal ban, and the lion beside the bronze griffin on the town hall marks the Guelph side it mostly backed.
Faction fights ended in lordship. In 1393 the condottiero Biordo Michelotti, leader of the popular Raspanti, entered the city and became its first lord until conspirators stabbed him in 1398. In 1400 the city handed itself to Gian Galeazzo Visconti of Milan, who wiped out its debt and died in 1402. Braccio da Montone, one of the nobles Biordo had exiled, took Perugia by force in 1416 and ruled moderately. His loggias survive on the side of the cathedral square.
The Baglioni family held a covert lordship from 1438, and the city grew under them: new roads, new palaces and a larger town hall. Their patronage drew Piero della Francesca, Pinturicchio and Raphael, and Perugino painted the audience hall of the Collegio del Cambio in those years. Then the family turned on its rivals and itself. The Red Wedding massacre came on 14 July 1500. In 1540 Rodolfo Baglioni, who had killed a papal legate, was beaten by Pier Luigi Farnese, and the soldiers plundered the city. The pope's fortress swallowed the Baglioni palace, and only part of it survives inside the Rocca Paolina.
French troops took the city in 1797, and in 1798 it became the capital of the short-lived Tiberina Republic. Earthquakes hit in 1832, 1838 and 1854. In June 1859 residents rose against the pope and Pius IX's troops crushed the revolt bloodily, and in September 1860 Umbria joined the Kingdom of Italy. The Second World War did only some damage, and British troops liberated the city on 20 June 1944. The hill still shapes daily life: since 1971 traffic restrictions have kept cars out of the centre at set hours, and lifts, escalators and a people mover now carry you up from the car parks below.