A method of controlling the grid-side current of a single-phase grid-connected converter having an LCL filter connected between the output of the converter and the grid. The method includes measuring a grid voltage (vS) and at least one signal in a group of signals consisting of a grid-side current (i0), a converter-side current (i1) and a capacitor voltage (vC0). The method includes estimating the fundamental component (vS,1) of the grid voltage (vS), forming a grid-side current reference (i0*), a converter-side current reference (i1*) and a capacitor voltage reference (vC0*) for the grid-side current of the LCL filter using the fundamental component of the grid voltage (vS,1), forming estimates for the non-measured signals in said group of signals, forming a grid-side current difference term (ĩ0), a converter-side current difference term (ĩ1) and a capacitor voltage difference term ({tilde over (v)}C0) from the differences between the references and measured/estimated values of said signals, forming an injection term for damping the resonance of the LCL filter by using an active damping injection mechanism (ADI), in which the grid-side current difference term (ĩ0), the converter-side current difference term (ĩ1) and the capacitor voltage difference term ({tilde over (v)}C0) are used, forming an estimate of harmonic distortion term ({circumflex over (φ)}) using the grid-side current difference term (ĩ0), and controlling the output voltage (e) of the converter on the basis of the grid voltage, formed injection term and formed estimate of the harmonic distortion term ({circumflex over (φ)}) to produce a grid side (i0) current corresponding to the current reference.