Motion of an object degrades MR images, as the acquisition is time-dependent, and thus k-space is inconsistently sampled. This causes ghosts. Current motion correction methods make restrictive assumptions on the type of motions, for example, that it is a translation or rotation, and use special properties of k-space for these transformations. Such methods, however, cannot be generalized easily to nonrigid types of motions, and even rotations in multiple shots can be a problem. Here, a method is presented that can handle general nonrigid motion models. A general matrix equation gives the corrupted image from the ideal object. Thus, inversion of this system allows us to get the ideal image from the corrupted one. This inversion is possible by efficient methods mixing Fourier transforms with the conjugate gradient method. A faster but empirical inversion is discussed as well as methods to determine the motion. Simulated three-dimensional affine data and two-dimensional pulsation data and in vivo nonrigid data are used for demonstration. All examples are multishot images where the object moves between shots. The results indicate that it is now possible to correct for nonrigid types of motion that are representative of many types of patient motion, although computation times remain an issue. Magn Reson Med, 2005. © 2005 Wiley-Liss, Inc.