The problem of controlling single-phase shunt active power filters is addressed in presence of nonlinear loads. The control strategy consists of two loops: an inner loop current to ensure the correction of the power factor compensation of reactive and deforming powers of the nonlinear load and an outer loop regulating the DC bus voltage of the active filter. The controller performances are formally analyzed using system averaging theory. Based on this model, a nonlinear controller using the technique of order 1 sliding modes the establishment of the current loop and the proportional-integral correction to the voltage loop has been developed. The theoretical results are illustrated by simulation.