A common factor in all illusory contour figures is the perception of a surface occluding part of a background. These surfaces are not constrained to be at constant depth and they can cross other surfaces. We address the problem of how the image organizations that yield illusory contours arise. Our approach is to iteratively find the most salient surface by (i) detecting occlusions; (ii) assigning salient-surface-states, a set of hypothesis of the local salient surface configuration; (iii) applying a Bayesian model to diffuse these safient-surface-states; and (iv) efficiently selecting the best image organization (set of hypothesis) based on the resulting diffused surface. We note that the illusory contours arise from the surface boundaries and the amodal completions emerge at the overlapping surfaces. The model reproduces various qualitative and quantitative aspects of illusory contour perception.