In 1512, Pope Julius II attacked Florence, because of events going on in Pisa. After the war, Soderini was removed from office and the prominent Medici family took control of Florence. Machiavelli was removed from his offices when this happened. In early 1513, an anti-Medici conspiracy was found and Machiavelli was accused of being an accomplice. He claimed innocence throughout prison and eventually he was released though restrictions were imposed upon him. Machiavelli then went to live outside of Florence at the house he had inherited from his father. During this time Machiavelli wrote The Prince (Il Principe) and another famous work, Discourses on the First Ten Books of Livy.
Machiavelli intended The Prince to serve as a guide to creating and holding on to a principality, in ways that often benefited the people, though perhaps indirectly. Machiavelli remembered how well off the French were because they were one principality united under one prince, and he wanted the same for Italy for he was patriotic and prized his freedom.