John Locke's philosophy grew out of a working political life, not a quiet academic one. After Oxford, where he trained in medicine as well as the standard curriculum, Locke became physician and close advisor to Anthony Ashley Cooper, later the first Earl of Shaftesbury, a leading opposition politician whose fortunes Locke's own rose and fell alongside for over a decade. When Shaftesbury's attempt to exclude the Catholic heir presumptive James from the English throne collapsed and Shaftesbury fled into exile, Locke followed him to the Dutch Republic, spending years there under suspicion from the English crown before returning only after the 1688 Glorious Revolution replaced James with the Protestant William and Mary.
He published his two major works anonymously that same return year, 1689: An Essay Concerning Human Understanding, arguing the mind begins as a blank slate, a tabula rasa, filled entirely through sensory experience and the mind's reflection on it rather than through any innate ideas implanted before birth, and the Two Treatises of Government, arguing that legitimate political authority rests on the consent of the governed, that individuals possess natural rights to life, liberty, and property that government exists to protect rather than grant, and that a government that betrays that trust may rightly be resisted by the people. Locke did not publicly acknowledge authorship of either book until near the end of his life, a caution shaped by the political dangers his own recent exile had made concrete.