The papal election from May 30, 1277 to November 25, 1277, convened in Viterbo after the death of Pope John XXI, was the smallest papal election since the expansion of suffrage to cardinal-priests and cardinal-deacons, with only seven cardinal electors (following the deaths of three popes who had not created cardinals). Because John XXI had revoked Ubi periculum, the papal bull of Pope Gregory X establishing the papal conclave, with his own bull Licet felicis recordationis, the cardinal electors were able to take their time. After six months of deliberation, the cardinals eventually elected their most senior member Giovanni Gaetano Orsini as Pope Nicholas III. From the end of the election until Nicholas III's first consistory on March 12, 1278, the number of living cardinals—seven—was the lowest in the history of the Roman Catholic Church.
The seven cardinal electors were evenly divided between three supporters of Charles of Anjou and three cardinals from prominent Roman families, who opposed the interests of Charles in Italy, and there was one uncommitted cardinal.
Initially, the cardinals met only once a day for balloting and returned to their respective habitations after the scrutinies. For two months, voting proceeded uneventfully along national lines with the French and Roman cardinals evenly divided.
After six months the impatient magistrates of Viterbo locked the cardinals in the town hall (once elected, Nicholas III moved the papacy back to Rome).