A Monte Carlo-type approach for low- and medium-resolution phasing of single-particle diffraction data is suggested. Firstly, the single-particle phase problem is substituted with the phase problem for an imaginary crystal. A unit cell of this crystal contains a single isolated particle surrounded by a large volume of bulk solvent. The developed phasing procedure then generates a large number of connected and finite molecular masks, calculates their Fourier coefficients, selects the sets with magnitudes that are highly correlated with the experimental values and finally aligns the selected phase sets and calculates the averaged phase values. A test with the known structure of monomeric photosystem II resulted in phases that have 97% correlation with the exact phases in the full 25 Å resolution shell (1054 structure factors) and correlations of 99, 94, 81 and 79% for the resolution shells ∞-60, 60-40, 40-30 and 30-25 Å, respectively. The same procedure may be used for crystallographic ab initio phasing.