Gottfried Wilhelm Leibniz, answered from the texts and cited to the page.
I am no Spinozist. That every predicate is contained in a substance's complete concept does not make every truth necessary. A truth is necessary only if its opposite implies a contradiction; that Caesar crossed the Rubicon implies none, and is contingent — false in other possible worlds, true in this one only because God, surveying all possible worlds, chose to create it.12
Existence is the root of contingency. Necessary truths admit a finite analysis reducible to identities; contingent truths have an analysis that runs to infinity, which God alone completes at a single view.3 Freedom is not the liberty of indifference, a will tipping with no reason, which is a chimera; it is spontaneity, intelligence, and contingency together. The reason inclines without necessitating, and human freedom mirrors the divine.45
The one whose contrary implies a contradiction is absolutely necessary; this deduction occurs in the eternal truths, for example, the truths of geometry. The other is necessary only ex hypothesi and, so to speak, accidentally, but it is contingent in itself, since its contrary does not imply a contradiction.Discourse on Metaphysics (1686), pp. 95–96
The other is necessary only ex hypothesi, and by accident, so to speak, and this connection is contingent in itself when its contrary implies no contradiction. A connection of this kind is not based on pure ideas and on the simple understanding of God but also on his free decrees and on the sequence of events in the universe. Let us take an example.Discourse on Metaphysics", 1686, pp. 322–323
Thus it would seem that the truths that are ultimately reducible to identities are no less necessary than the identities that they are reducible to. But these are the only sorts of truths that Leibniz recognizes, and if they are all necessary then obviously there can be no contingency in the Leibnizian universe at all.The Shorter Leibniz Texts, pp. 14–15
This makes them alone susceptible of punishment and reward and citizens of the commonwealth of the universe of which God is the monarch. It follows also that all the other creatures should serve them; a matter which we shall discuss more fully later. 13.Discourse on Metaphysics", 1686, p. 322
On contingency (spring-autumn 1689?) In God, existence does not differ from essence, or what is the same thing, it is essential for God to exist. Hence God is a necessary being. 110 B. CONTINGENCY AND NECESSITY Creatures are contingent, that is, their existence does not follow from their essence.The Shorter Leibniz Texts, p. 111
The charge that the concept-containment theory collapses into Spinozistic necessitarianism is the oldest objection to Leibniz's system, pressed by Arnauld and renewed since. Leibniz himself states it candidly in Discourse §13. The three contingency strategies — hypothetical versus absolute necessity, possible worlds, and infinite analysis — are among the most studied and contested elements of his philosophy; whether any of them genuinely secures contingency remains debated.