Let L=(L,[⋅,⋅],δ) be an algebraic Lie algebroid over a smooth projective curve X of genus g≥2 such that L is a line bundle whose degree is less than 2−2g. Let r and d be coprime numbers. We prove that the motivic class of the moduli space of L-connections of rank r and degree d over X does not depend on the Lie algebroid structure [⋅,⋅] and δ of L and neither on the line bundle L itself, but only on the degree of L (and of course on r, d and X). In particular it is equal to the motivic class of the moduli space of KX(D)-twisted Higgs bundles of rank r and degree d, for D any effective divisor with the appropriate degree. As a consequence, similar results (actually slightly stronger) are obtained for the corresponding E-polynomials. Some applications of these results are then deduced.