A variational justification of linear elasticity with residual stress