A model is proposed that describes the evolution of a mixed state of a quantum system for which gain and loss of energy or amplitude are present. Properties of the model are worked out in detail. In particular, invariant subspaces of the space of density matrices corresponding to the fixed points of the dynamics are identified, and the existence of a transition between the phase in which gain and loss are balanced and the phase in which this balance is lost is illustrated in terms of the time average of observables. The model is extended to include a noise term that results from a uniform random perturbation generated by white noise. Numerical studies of example systems show the emergence of equilibrium states that suppress the phase transition.