A method was derived that maximizes the genetic level of selected animals while constraining their average coancestry to a predefined value. The average coancestry of the selected parents equals the inbreeding level in the next generation, so that rates of inbreeding were controlled. When this method was applied for several generations of selection, stable rates of genetic gain were attained, which indicates that the method could control the short- and long-term effects of selection on inbreeding. At equal rates of inbreeding, genetic gains were 21 to 60% greater than that with selection for BLUP-EBV, because of increased selection differentials. The difference was larger when the desirable rate of inbreeding was smallest. Selection with a constraint on inbreeding required only EBV of, and relationships between, the selection candidates and is therefore easy to apply in practice. The optimal solution is expressed in genetic contributions of selection candidates to the next generation, which is equivalent to numbers of offspring per candidate. These optimal numbers of offspring may be difficult to attain because of female reproductive limitations. The optimal method could be adapted to situations with additional reproductive constraints. The method can also be used to constrain the variance of response by restricting the average prediction error variance of the selected animals.