Characterizing foliations pulled back from surfaces

Joint with J.V. Pereira. The classical Jouanolou theorem characterizes foliations with an infinite number of algebraic leaves.
We present a variant on this theorem which characterizes those foliations which are pull-backs along rational maps to surfaces.
As an application we will provide a structure theorem for foliations $\mathcal{F}$ on threefolds which admit infinitely many $K_{\mathcal{F}}$-negative extremal rays.