The Structure Theorem for Hopf modules states that if a bialgebra $H$ is a Hopf algebra (i.e. it is endowed with a so-called antipode) then every Hopf module $M$ is of the form ${M}^{mathrm{co}{H}}otimes H$, where ${M}^{mathrm{co}{H}}$ denotes the space of coinvariant elements in $M$. Actually, it has been shown that this result characterizes Hopf algebras: $H$ is a Hopf algebra if and only if every Hopf module $M$ can be decomposed in such a way. The main aim of this paper is to extend this characterization to the framework of quasi-bialgebras by introducing the notion of preantipode and by proving a Structure Theorem for quasi-Hopf bimodules. We will also establish the uniqueness of the preantipode and the closure of the family of quasi-bialgebras with preantipode under gauge transformation. Then, we will prove that every Hopf and quasi-Hopf algebra (i.e. a quasi-bialgebra with quasi-antipode) admits a preantipode and we will show how some previous results, as the Structure Theorem for Hopf modules, the Hausser-Nill theorem and the Bulacu-Caenepeel theorem for quasi-Hopf algebras, can be deduced from our Structure Theorem. Furthermore, we will investigate the relationship between the preantipode and the quasi-antipode and we will study a number of cases in which the two notions are equivalent: ordinary bialgebras endowed with trivial reassociator, commutative quasi-bialgebras, finite-dimensional quasi-bialgebras.