Method for operating a metal detector that comprises a balanced coil system with a drive coil that is connected to a transmitter unit, which provides a transmitter signal with at least one operating frequency (f TX), and with a first and a second detection coil (22, 23) that provide an output signal to a receiver unit, that processes a related receiver signal, which comprises an imbalance signal and other signals relating to products and/or metal contaminants, and that provides demodulated digital in-phase and quadrature components (d I, d Q) which are analysed in a control unit in order to detect metal contaminants in products that are examined by the metal detector, characterized by the steps of □ using at least one low pass filter (40I; 40Q) for separating the demodulated digital in-phase and quadrature components (d I, d Q) of the imbalance signal in a signal controller from the demodulated digital in-phase and quadrature components (d I, d Q) of the related receiver signal; □ processing the digital in-phase and digital quadrature components (d I, d Q) of the imbalance signal in a signal controller for separating the imbalance signal from signals relating to products and contaminants and providing control data to a compensation unit that is used for compensating the imbalance signal, wherein said step of processing comprises: applying the digital in-phase components (d I) of the imbalance signal to a first control unit, which provides an in-phase control component (d CI) for the imbalance signal and applying the digital quadrature components (d Q) of the imbalance signal to a second control unit, which provides a quadrature control component (d CQ) for the imbalance signal; □ in the compensation unit, synthesizing a digital compensation signal (d COMP) with the frequency of the imbalance signal, which corresponds to the at least one operating frequency (f TX), and with a phase and magnitude according to the in-phase and quadrature control components (d CI, d CQ) provided for the imbalance signal; □ converting the digital compensation signal (d COMP) into an analogue compensation signal (a COMP), and □ applying the analogue compensation signal (a COMP) to the balanced coil system or to the receiver signal (s2, s3) for compensating the imbalance signal. □ using at least one low pass filter (40I; 40Q) for separating the demodulated digital in-phase and quadrature components (d I, d Q) of the imbalance signal in a signal controller from the demodulated digital in-phase and quadrature components (d I, d Q) of the related receiver signal; □ processing the digital in-phase and digital quadrature components (d I, d Q) of the imbalance signal in a signal controller for separating the imbalance signal from signals relating to products and contaminants and providing control data to a compensation unit that is used for compensating the imbalance signal, wherein said step of processing comprises: applying the digital in-phase components (d I) of the imbalance signal to a first control unit, which provides an in-phase control component (d CI) for the imbalance signal and applying the digital quadrature components (d Q) of the imbalance signal to a second control unit, which provides a quadrature control component (d CQ) for the imbalance signal; □ in the compensation unit, synthesizing a digital compensation signal (d COMP) with the frequency of the imbalance signal, which corresponds to the at least one operating frequency (f TX), and with a phase and magnitude according to the in-phase and quadrature control components (d CI, d CQ) provided for the imbalance signal; □ converting the digital compensation signal (d COMP) into an analogue compensation signal (a COMP), and □ applying the analogue compensation signal (a COMP) to the balanced coil system or to the receiver signal (s2, s3) for compensating the imbalance signal.