We examine in a generic context how the mu problem can be resolved by means of a spontaneously broken gauge symmetry. We then focus on the new scheme based on a discrete gauge R symmetry which is spontaneously broken by nonperturbative hidden sector dynamics triggering supersymmetry breaking also. The possibility to suppress the dangerous baryon and/or lepton-number-violating interactions by means of this discrete R symmetry is examined also together with some phenomenological consequences.