In the first part of the paper, we develop a theory of crossed products of a C ⁎ -algebra A by an arbitrary (not necessarily extendible) endomorphism α : A → A . We consider relative crossed products C ⁎ ( A , α ; J ) where J is an ideal in A , and describe up to Morita–Rieffel equivalence all gauge-invariant ideals in C ⁎ ( A , α ; J ) and give six term exact sequences determining their K -theory. We also obtain certain criteria implying that all ideals in C ⁎ ( A , α ; J ) are gauge-invariant, and that C ⁎ ( A , α ; J ) is purely infinite. In the second part, we consider a situation where A is a C 0 ( X ) -algebra and α is such that α ( f a ) = Φ ( f ) α ( a ) , a ∈ A , f ∈ C 0 ( X ) where Φ is an endomorphism of C 0 ( X ) . Pictorially speaking, α is a mixture of a topological dynamical system ( X , φ ) dual to ( C 0 ( X ) , Φ ) and a continuous field of homomorphisms α x between the fibers A ( x ) , x ∈ X , of the corresponding C ⁎ -bundle. For systems described above, we establish efficient conditions for the uniqueness property, gauge-invariance of all ideals, and pure infiniteness of C ⁎ ( A , α ; J ) . We apply these results to the case when X = Prim ( A ) is a Hausdorff space. In particular, if the associated C ⁎ -bundle is trivial, we obtain formulas for K -groups of all ideals in C ⁎ ( A , α ; J ) . In this way, we constitute a large class of crossed products whose ideal structure and K -theory is completely described in terms of ( X , φ , { α x } x ∈ X ; Y ) where Y is a closed subset of X . [ABSTRACT FROM AUTHOR]