Abstract. We set up an infinite dimensional differential structure for the set of causal curves joining two submanifolds $P$ and $\Gamma$ of a Lorentzian manifold $\M$, and we prove a variational principle that characterizes the timelike geodesics. Such principle, which is obtained using a sort of {\em arrival time\/} functional, is given by a general-relativistic version of the Fermat's principle for light rays in Classical Optics. The lightlike geodesics between $P$ and $\Gamma$ are obtained with a limit process, which is briefly discussed in the last section.
AMSclassification. 53C22, 53C50, 58E30
Keywords. Lorentzian geometry, causal geodesics, Fermat's Principle