We consider a Hamiltonian setup $(\mathcal M,\omega,H,\mathfrak L,\Gamma,\mathcal P)$, where $(\mathcal M,\omega)$ is a symplectic manifold, $\mathfrak L$ is a distribution of Lagrangian subspaces in $\mathcal M$, $\mathcal P$ is a Lagrangian submanifold of $\mathcal M$, $H$ is a smooth time-dependent Hamiltonian function on $\mathcal M$, and $\Gamma:[a,b]\to\mathcal M$ is an integral curve of the Hamiltonian flow $\vec H$ starting at $\mathcal P$. We do not require any convexity property of the Hamiltonian function $H$. Under the assumption that $\Gamma(b)$ is not $\mathcal P$-focal, we introduce the Maslov index $\mathrm i_{\mathrm{maslov}}(\Gamma)$ of $\Gamma$ given in terms of the first relative homology group of the Lagrangian Grassmannian; under generic circumstances $\mathrm i_{\mathrm{maslov}}(\Gamma)$ is computed as a sort of algebraic count of the $\mathcal P$-focal points along $\Gamma$. We prove the following version of the Index Theorem: under suitable hypotheses, the Morse index of the Lagrangian action functional restricted to suitable variations of $\Gamma$ is equal to the sum of $\mathrm i_{\mathrm{maslov}}(\Gamma)$ and a convexity term of the Hamiltonian $H$ relative to the submanifold $\mathcal P$. When the result is applied to the case of the cotangent bundle $\mathcal M=TM^*$ of a semi-Riemannian manifold $(M,g)$ and to the geodesic Hamiltonian $H(q,p)=\frac12 g^{-1}(p,p)$, we obtain a semi-Riemannian version of the celebrated Morse Index Theorem for geodesics with variable endpoints in Riemannian geometry.
2000 Mathematical Subject Classification: 37J05, 53C22, 53C50, 53D12, 70H05.