Leibniz believed in freedom, both divine and human, and he thought that contingency was a necessary condition of freedom. That is, if an agent A acts freely when choosing X, then A's choosing X cannot be necessary. But there are some elements in his philosophy that seem to make contingency impossible.
