\begin{abstract} For a {\em Hopf algebra} $H$ over a commutative ring $k$, the category $\M_H^H$ of right Hopf modules is equivalent to the category $\M_k$ of $k$-modules, that is, the comparison functor $-\ot_kH: \M_k\to \M^H_H$ is an equivalence (Fundamental theorem of Hopf modules). This was proved by Larson and Sweedler via the notion of {\em coinvariants} $M^{coH}$ for any $M\in \M_H^H$. The coinvariants functor $(-)^{coH}:{\M_H^H}\to \M_k$ is right adjoint to the comparison functor and can be understood as the Hom-functor $\Hom_H^H(H, -)$ (without referring to an antipode). For a {\em quasi-Hopf algebra} $H$, the category $_H\M^H_H$ of \emph{quasi-Hopf $H$-bimodules} has been introduced by Hausser and Nill and \emph{coinvariants} are defined to show that the functor $-\ot_kH: \M_k\to {_H\M^H_H}$ is an equivalence. It is the purpose of this paper to show that the related coinvariants functor, right adjoint to the comparison functor, can be seen as the functor $_H\Hom^H_H(H\ot_kH,-)$ More generally, let $H$ be a \emph{quasi-bialgebra} and $\cA$ an $H$-comodule algebra $\cA$ (as introduced by Hausser and Nill). Then $-\ot_kH$ is a comonad on the category $_\cA\M_H$ of $(\cA,H)$-bimodules and defines the Eilenberg-Moore comodule category $(_\cA\M_H)^{-\ot H}$ which is just the category $_\cA\M_H^H$ of two-sided Hopf modules. Following ideas of Hausser, Nill, Bulacu, Caenepeel and others, two types of coinvariants are defined to describe right adjoints of the comparison functor $-\ot_kH:{_\cA\M}\to {_\cA\M_H^H}$ and to establish an equivalence between the categories $_\cA\M$ and $_\cA\M^H_H$ provided $H$ has a quasi-antipode. As our main results we show that these coinvariants functors are isomorphic to the functor ${_\cA\Hom^H_H}(\cA\otimes_kH, -): {_\cA\M_H^H}\to{_\cA\M}$ and give explicit formulas for these isomorphisms. \end{abstract}