Let L = (L, [• , •], δ) be an algebraic Lie algebroid over a smooth projective curve 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 (in the Grothendieck ring of varieties) 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 the degree of L (and of course on r, d, g 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 divisor of positive degree. As a consequence, similar results (actually a little stronger) are obtained for the corresponding E-polynomials. Some applications of these results are then deduced.