  We introduce a self-consistent framework for the analysis of both Abelian and
non-Abelian geometric phases associated with open quantum systems, undergoing
cyclic adiabatic evolution. We derive a general expression for geometric
phases, based on an adiabatic approximation developed within an inherently
open-systems approach. This expression provides a natural generalization of the
analogous one for closed quantum systems, and we prove that it satisfies all
the properties one might expect of a good definition of a geometric phase,
including gauge invariance. A striking consequence is the emergence of a finite
time interval for the observation of geometric phases. The formalism is
illustrated via the canonical example of a spin-1/2 particle in a
time-dependent magnetic field. Remarkably, the geometric phase in this case is
immune to dephasing and spontaneous emission in the renormalized Hamiltonian
eigenstate basis. This result positively impacts holonomic quantum computing.
