We use the theory of dynamical invariants to yield a simple derivation of n
oncyclic analogues of the Abelian and non-Abelian geometric phases. This de
rivation relies only on the principle of gauge invariance and elucidates th
e existing definitions of the Abelian nancyclic geometric phase. We also di
scuss the adiabatic limit of the noncyclic geometric phase and compute the
adiabatic non-Abelian noncyclic geometric phase for a spin-1 magnetic (or e
lectric) quadrupole interacting with a precessing magnetic (electric) field
.