He conducted a suit on behalf of the students against the Guardians of the Ospedale di San Giovanni, who were protectors of the Capranica, but engaged in maladministration and tyranny.
[5] Due to the diseases prevalent in Rome, collectively called the mal aerea, Niccolò transferred to the University of Perugia.
He obtained the degree of Doctor in utroque iure, and joined the college of consistorial advocates in the Roman Curia.
The Orsini made war against the Pope, and in January 1497 captured Guidobaldo da Montefeltro, the Duke of Urbino and captain general of the papal army.
[8] Bonafede arrived in Venice on 3 January 1498, and remained there for twelve months, to the satisfaction of both the Signoria of the Serene Republic and Pope Alexander VI, no easy task.
After a short rest and recuperation in his native land, he returned to Rome, where he was immediately assigned, on 15 January 1499, to be governor of Benevento, which was being attacked and subverted by agents of King Ferdinando of Naples.
To assist Cesare Borgia in the Pope's plan to reclaim the Duchy of Urbino and the lordship of Camerino, Bonafede was summoned to become Commissary General of the papal forces.
[11] Cesare Borgia was left to defend the interests of the family and his own position, as well as to produce a new pope who would be friendly to the Spanish cause.
[12] In the Conclave which followed, Bonafede participated as a conclavist of Cardinal Francesco de Loris, the Archbishop of Constantinople.
In the second conclave, on 1 November 1503, Cardinal Giuliano della Rovere was elected Pope Julius II by acclamation.
Three weeks after his election, on 21 November, Pope Julius named Niccolò Bonafede Vice-Chamberlain and Governor of Rome.
Pope Julius predicted that he would fail, if only because of the lack of cooperation of the cardinals and nobles, many of whom kept small armies of retainers.
[18] The office was greatly desired by Cardinal Pietro Isvalies, Archbishop of Reggio Calabria, for one of his familiars, and he offered the exchange of one of his benefices in the Roman Curia.
[19] At the same time, Julius granted Bonafede full possession of the parish church of S. Maria in Telusiano in Niccolò's home town of San Giusto.
For four months he was unable to carry out the duties of his office, as the principal administrator and civil judge of the city, as the second highest official of the Apostolic Treasury, after the Cardinal Camerlengo, and as a regular attendant and advisor at papal consistories.
Julius was incensed, and the Cardinal of Pavia, Francesco Alidosi, quickly wrote Niccolò a folio-length letter in his own hand advising Bonafede to capitulate to the Pope's wishes and try to placate him.
Julius was persuaded to appoint him Commissary General for his Bolognese campaign, and replace him in Forlì with the Bishop of Amelia, Giustiniano de' Moriconi.
As one Bolognese fortress after another fell to papal troops, led by the Duke of Urbino, the Bentivogli evacuated Bologna and the Pope and Bonafede entered the city on 11 November 1506.
Niccolò followed along, and in an interview managed to persuade the Pope (who wanted him to serve as Vice-Legate of Bologna) to allow him to return home to San Giusto.
Julius immediately appointed Niccolò governor of Modena, where he was challenged by the forces of Marc'Antonio Colonna, who was in the service of Milan.
When King Louis XII arrived in the neighborhood of Bologna, several of Bonafede's friends among the cardinals advised him to flee the city, but he refused, pointing out that the Bolognese had taken great risks to save him from Trivulzio, and stealing away would be a serious mistake; only if he were promoted to a high office in Rome could he depart, something Julius was not prepared to do; Bonafede then demanded instead to be reconfirmed as governor.
The principal façade has an inscription, "Nicolò Bonafede, Distinguished and Experienced Man, Bishop of Chiusi, having discharged with great distinction military missions for the Apostolic See, most recently against the French, and the governorship of a great many provinces [including] Bologna and Rome, has erected this house for his own repose and for the advantage of [his] descendants, and having demolished the little dwellings, he decorated [the palace] with attractive brickwork in the distinguished piazza, 23 October 1513.
His actions, however, were looked on jealously by the Orsini faction, who had been supporters of Ludovico Euffreducci, and with the assistance of the Pope's sister, they determined to end Bonafede's tenure, and replace him with the bishop of Rimini, Fabio Cerri.