Nonlinear loads such as ac drives, switch-mode power supplies and grid-connected converters can cause, in addition to the generation of unwanted current harmonics, a dc current component injection into the grid. This dc current component can lead to magnetic saturation of the distribution power transformers, leading to higher current distortion and overheating. This paper presents a method to detect the dc current component flowing into the distribution power transformer with a precise measurement of the dc voltage component at the transformer winding. A magnetic sensor has been developed and implemented in a closed-loop control system to achieve a high sensitivity and guarantees a good linearity with a high rejection ratio to grid voltage variations. Simulation and experimental results confirm the effectiveness of the proposed approach.