  We prove a semi-Riemannian version of the celebrated Morse Index Theorem for
geodesics in semi-Riemannian manifolds; we consider the general case of both
endpoints variable on two submanifolds. The key role of the theory is played by
the notion of the {\em Maslov index} of a semi-Riemannian geodesic, which is a
homological invariant and it substitutes the notion of geometric index in
Riemannian geometry. Under generic circumstances, the Maslov index of a
geodesic is computed as a sort of {\em algebraic count} of the conjugate points
along the geodesic. For non positive definite metrics the index of the index
form is always infinite; in this paper we prove that the space of all
variations of a given geodesic has a {\em natural} splitting into two infinite
dimensional subspaces, and the Maslov index is given by the difference of the
index and the coindex of the restriction of the index form to these subspaces.
In the case of variable endpoints, two suitable correction terms, defined in
terms of the endmanifolds, are added to the equality. Using appropriate change
of variables, the theory is entirely extended to the more general case of {\em
symplectic differential systems}, that can be obtained as linearizations of the
Hamilton equations.
