  In general, a system of differential equations is integrable if there exist
`sufficiently many' first integrals (FIs) so that its solution can be found by
means of quadratures. Therefore, the determination of the FIs is an important
issue in order to establish the integrability of a dynamical system. In this
work, we consider holonomic autonomous dynamical systems defined by equations
$\ddot{q}^{a}= -\Gamma_{bc}^{a}(q) \dot{q}^{b}\dot{q}^{c} -Q^{a}(q)$ where
$\Gamma^{a}_{bc}(q)$ are the coefficients of a symmetric (possibly
non-metrical) connection and $-Q^{a}(q)$ are the generalized forces. We prove a
theorem which produces the FIs of any order of such systems in terms of the
`symmetries' of the geometry defined by the quantities $\Gamma_{bc}^{a}(q)$. We
apply the theorem to compute quadratic and cubic FIs of various dynamical
systems.
