If the dedication of Il Principe (1513) to Lorenzo II de' Medici had not any effect, part of the then dominant faction of Florence was not against him, and instead granted him an appointment.
To sustain that timid request Machiavelli, with a considerably courtier-like spirit, set his Mandragola for the wedding of Lorenzino de' Medici (1518).
The composition of the work presented a problem, for it was clear that the commission was not meant to give him the opportunity to eulogize the Republic of Florence, of which Machiavelli had been titled "il segretario" (the secretary) par excellence.
What was expected of him, if not a glorification of the Medici family, was a treatise without polemics and tending to show the present state of things as a natural evolution.
The books II, III, and IV narrate the history before the Medici rise, while the last four speak of the fight for power that ended with the Medicean lordship.