We consider autonomous holonomic dynamical systems defined by equations of the form qa = −Γ a bc (q) qb qc −Q a (q), where Γ 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 for these systems determines autonomous and timedependent first integrals (FIs) of any order in a systematic way, using the 'symmetries' of the geometry defined by the dynamical equations. We demonstrate the application of the theorem to compute linear, quadratic, and cubic FIs of various Riemannian and non-Riemannian dynamical systems.