A new optimization method for the design of nearly linear-phase IIR digital filters that satisfy prescribed specifications is proposed. The group-delay deviation is minimized under the constraint that the passband ripple and stopband attenuation are within the prescribed specifications and either a prescribed or an optimized group delay can be achieved. By representing the filter in terms of a cascade of second-order sections, a non-restrictive stability constraint characterized by a set of linear inequality constraints can be incorporated in the optimization algorithm. An additional feature of the method, which is very useful in certain applications, is that it provides the capability of constraining the maximum gain in transition bands to be below a prescribed level. Experimental results show that filters designed using the proposed method have much lower group-delay deviation for the same passband ripple and stopband attenuation when compared with corresponding filters designed with several state-of-the-art competing methods.