A multireference perturbation method that is based on Rayleigh-Schrodinger perturbation theory and uses an optimized partitioning is presented. The method is abbreviated as MROPT. The optimization of the zeroth-order energies for the nth-order MROPT method is performed by putting a condition Ψ(n)=0 on the first neglected term in the perturbative expansion of the wave function. This allows for cancellation of a large part of errors arising from truncating the wave function. Explicit equations that enable determining the optimized zeroth-order energies for the second-, third-, and fourt-order perturbation theory are given.