The aim of the present paper is to show that an accretion disk, the material of which satisfies the Navier-Stokes equations of a compressible fluid, is secularly unstable to axisymmetric density disturbances even if Toomre's parameter Q is greater than one. This instability process, which can also be interpreted as negative diffusion, leads immediately to the formation of rings in the accretion disk as an intermediate step in the formation of planets, at least for the outer gaseous ones. We believe that the same process is also responsible for the ringlet-structure of planetary rings. Only a dynamical instability of axisymmetric density wave perturbations, represented by Toomre's condition Q < 1, does not exist in a viscous self-gravitating disk. On the base of a local theory we calculate the characteristic wave number and the corresponding time scale of the mode of maximum secular instability. In the global theory, we formulate a complex linear integral equation describing the diffusion instability in the accretion disk. The radial distances of the rings to the protosun obey in the outer range of the disk an exponential law provided that the quantity vo (the vertically integrated viscosity) is nearly constant throughout the disk. Our treatment gives arguments in favour for the result, that the spacing ratio 4 = r,,+I/r,, between two consecutive protoplanetary orbits is approximately given by the formula CJ = exp(2r+r"), where p is close to the ratio of the accreted ring-masses in the disk and the mass of the central body. We believe that the formation process is shorter for the outer gaseous than for the inner rocky planets, because the global secular ring instability is evanescent in the inner regions of the disk.