In order to define an optimal true-amplitude prestack depth migration for multishot and multitrace data, we develop a general methodology based on the least-squares data misfit function associated with a forward model. The amplitude of the migrated events are restored at best for any given geometry and any given preliminary filtering and amplitude correction of the data. The migrated section is then the gradient of the cost function multiplied by a weight matrix. A study of the Hessian associated with this data misfit shows how efficiently to find a good weight matrix via the computation of only few elements of this Hessian. Thanks to this matrix,the resulting migration operator is optimal in the sense that it ensures the best possible restoration of the amplitudes among the large class of least-squares migrations. Applied to a forward model based on Born, ray tracing, and diffracting points approximation, this optimal migration outperforms or at least equals the classic Kirchhoff formula, since the latter belongs to the class of least-squares migrations and is only optimal for one shot and an infinite aperture. Numerical results illustrate this construction and confirm the above expectations.