Context. The understanding of fossil fields origin, topology and stability is one of the corner stones of the stellar magnetism theory. On one hand, since they survive over secular time-scales, they may modify the structure and the evolution of their host stars. On the other hand, they must have a complex stable structure since it has been demonstrated by Tayler and collaborators that simplest purely poloidal or toroidal fields are unstable on dynamical time-scales. In this context, the only stable configuration which has been found today is the one resulting of a numerical simulation by Braithwaite and collaborators who have studied the evolution of an initial stochastic magnetic field, which is found to relax on a mixed stable configuration (poloidal and toroidal) that seems to be in equilibrium and then diffuses. Aims. In this work, we thus go on the track of such type of equilibrium field in a semi-analytical way. Methods. In this first article, we study the barotropic magnetohydrostatic equilibrium states; the problem reduces to a Grad-Shafranov-like equation with arbitrary functions. Those latters are constrained by deriving the lowest-energy equilibrium states for given invariants of the considered axisymmetric problem and in particular for a given helicity which is known to be one of the main actor of such problems. Then, we obtain the generalization of the force-free Taylor's relaxation states obtained in laboratory experiments (in spheromaks) that become non force-free in the self-gravitating stellar case. The case of general baroclinic equilibrium states will be studied in Paper II. Results. Those theoretical results are applied to realistic stellar cases, namely to the solar radiative core and to the envelope of an Ap star, and discussed. In both cases we assume that the field is initially confined in the stellar radiation zone.