We describe and analyse the operation and stabilization of a Mach--Zehnder interferometer, which separates the carrier and the first-order sidebands of a phase-modulated laser field, and which is locked using the H\"ansch--Couillaud method. In addition to the necessary attenuation, our interferometer introduces, via total internal reflection, a significant polarization-dependent phase delay. We employ a general treatment to describe an interferometer with an object which affects the field along one path, and we examine how this phase delay affects the error signal. We discuss the requirements necessary to ensure the lock point remains unchanged when phase modulation is introduced, and we demonstrate and characterize this locking experimentally. Finally, we suggest an extension to this locking strategy using heterodyne detection.