The discovery of giant planets in wide orbits represents a major challenge for planet formation theory. In the standard core accretion paradigm planets are expected to form at radial distances $lesssim 20$ au in order to form massive cores (with masses $gtrsim 10~textrm{M}_{oplus}$) able to trigger the gaseous runaway growth before the dissipation of the disc. This has encouraged authors to find modifications of the standard scenario as well as alternative theories like the formation of planets by gravitational instabilities in the disc to explain the existence of giant planets in wide orbits. However, there is not yet consensus on how these systems are formed. In this letter, we present a new natural mechanism for the formation of giant planets in wide orbits within the core accretion paradigm. If photoevaporation is considered, after a few Myr of viscous evolution a gap in the gaseous disc is opened. We found that, under particular circumstances planet migration becomes synchronised with the evolution of the gap, which results in an efficient outward planet migration. This mechanism is found to allow the formation of giant planets with masses $M_plesssim 1 M_{rm Jup}$ in wide stable orbits as large as $sim$130 au from the central star.