Jerome Masci (Girolamo Masci) was born on 30 September 1227 at Lisciano, near Ascoli Piceno. He was a pious, peace-loving man whose goals as a Franciscan friar were to protect the Church, promote the crusades, and root out heresy. According to Heinrich of Rebdorf, he was a Doctor of Theology. As a Franciscan friar, he had been elected the Order's superior (minister) for Dalmatia during the Franciscan general chapter held at Pisa in 1272. Pope Gregory X (1271-1276), was sending a legate to the Greek Emperor, Michael Palaiologos, in 1272, to invite the participation of Greek prelates in the Second Council of Lyons. The Pope's ambition was to achieve a reunion of Eastern and Western Christendom. St Bonaventure, then Minister General of the Order of Friars Minor (Franciscans) was asked to select four Franciscans to accompany the Legation as Nuncios. He chose Friar Jerome Masci as one of the four. When Bonaventure, died suddenly during the fifth session of the Order's General Chapter at Lyons on 15 July 1274, Friar Jerome Masci was elected to succeed him as the Franciscan Minister General, even though he was absent at the time, only then returning with the Greek delegates from the embassy to Constantinople.
Jerome was the associate of John of Vercelli, Master General of the Dominican Order, when the latter was sent by Pope Nicholas III (Giovanni Caetani Orsini) on 15 October 1277, to arrange a peace between Philip IV of France and Alfonso III of Aragon. Jerome and John of Vercelli were again appointed to the same task on 4 April 1278. At the same time, Jerome was ordered to continue for the time being as the Franciscan Minister General.
In 1278 Jerome was made Cardinal Priest by Pope Nicholas III, and at some point after 16 May 1279 was assigned the titular church of Santa Pudenziana. Even after his appointment as a cardinal, he was allowed to remain as Minister General of the Franciscans until the next general chapter. In the event, however, he was unable to attend the chapter for reasons of ill health, as a letter of apology of Pope Nicholas III, written in May 1279, indicates. On 12 April 1281 he was promoted Cardinal Bishop of Palestrina by Pope Martin IV.
After the death of Pope Honorius IV on 3 April 1287, the Conclave was held in Rome, at the papal palace next to Santa Sabina on the Aventine Hill, where Pope Honorius had died. This was in accordance with the Constitution "Ubi Periculum" of Pope Gregory X. At the beginning, in April, there were thirteen cardinals in Rome; three Cardinals—Gerardo Bianchi, Giovanni Boccamati, and Jean Cholet—did not attend at all. The Sacred College was for a time hopelessly divided in its selection of a successor. When six of the electors died during the year 1287 (Ancher Pantaleon, Geoffrey de Bar, Hugh of Evesham, Giordano Orsini, Comes de Casanate, and Goffredo of Alatri—some, at least, carried off by fever), the others, with the sole exception of Jerome Masci, left the Conclave and returned to their homes. It was not until the following year that they reassembled. The electors at that time were seven in number: Jerome Masci, along with Latino Malabranca, Bentivenga de Bentivengis, Bernard de Languissel, Matteo Rosso Orsini, Giacomo Colonna, and Benedetto Caetani. On 15 February 1288, the survivors unanimously elected Jerome Masci, to the papacy on the first scrutiny. It is said that the Cardinals were impressed by his steadfastness in remaining at the papal palace, but there is no real documentation as to their motives. As he admitted in his electoral manifesto, Cardinal Masci was extremely reluctant to accept, and indeed he persisted in his refusal for an entire week. Finally, on 22 February, he gave in and agreed. He became the first Franciscan pope and chose the name Nicholas IV in remembrance of Nicholas III, who had made him a Cardinal.
Given the considerable losses to the numbers of the Sacred College in 1286 and 1287, it is not surprising that Nicholas IV quickly proceeded to fill vacancies. What is surprising is that he did not even reach the number of cardinals who were alive under Honorius IV, let alone exceed it. On 16 May 1288, he named six new cardinals: Bernardus Calliensis, Bishop of Osimo (who died in 1291), Hugues Aiscelin (Seguin) de Billon, OP, of the diocese of Clermont in the Auvergne; Matthew of Aquasparta in Tuscany, Minister General of the Franciscans since 1287; Pietro Peregrosso of Milan, the Vice-Chancellor of the Holy Roman Church; Napoleone Orsini; and Pietro Colonna.