A numerical simulation algorithm for lattice QCD is described, in which the short-and long-distance effects of the sea quarks are treated separately. The algorithm can be regarded, to some extent, as an implementation at the quantum level of the classical Schwarz alternating procedure for the solution of elliptic partial differential equations. No numerical tests are reported here, but theoretical arguments suggest that the algorithm should work well also at small quark masses.