It was Hume's critique of necessity in nature that awoke Immanuel Kant (1724–1804) from his "dogmatic slumber," as he himself famously stated. In his Critique of Pure Reason (1787), Kant tried to demonstrate that the principle of causality—namely, "everything that happens, that is, begins to be, presupposes something upon which it follows by rule," (1965 ed., p. 218)—is a precondition for the very possibility of objective experience. He took the principle of causality to be required for the mind to make sense of the temporal irreversibility that there is in certain sequences of impressions. So, whereas we can have the sequence of impressions that correspond to the sides of a house in any order we please, the sequence of impressions that correspond to a ship going downstream cannot be reversed: it exhibits a certain temporal order (or direction). This temporal order by which certain impressions appear can be taken to constitute an objective happening only if the later event is taken to be necessarily determined by the earlier one (i.e., to follow by rule from its cause). For Kant, objective events are not "given": they are constituted by the organizing activity of the mind and in particular by the imposition of the principle of causality on the phenomena. Consequently, the principle of causality is, for Kant, a synthetic a priori principle.
Ingenious though Kant's answer to Hume was, it was ironic in three respects. Firstly, Kant safeguarded the concept of causality but at the price of making it applicable only to the phenomena and not to the unknowable things-in-themselves (noumena). Secondly, recall that Hume argued that the supposed necessity of causal sequences cannot be observed in the sequences themselves, but is projected by the mind onto the world. Kant agreed with all this, but took this projection by the mind onto the world to be presupposed for the distinction between causal and noncausal sequences. Thirdly, Kant identified causality with the rule of natural law: causal sequences of events are lawful sequences of events. This became the main plank of the Humean philosophical tradition. Stripped from objective necessity, natural laws boil down to worldly regularities.