The cross section of the diffractive process e^+p -> e^+Xp is measured at a centre-of-mass energy of 318 GeV, where the system X contains at least two jets and the leading final state proton p is detected in the H1 Very Forward Proton Spectrometer. The measurement is performed in photoproduction with photon virtualities Q^2 <2 GeV^2 and in deep-inelastic scattering with 4 GeV^2