The presence of salt in seawater strongly affects the melt rate and the shape evolution of ice, both of utmost relevance in ice–ocean interactions and thus for the climate. To get a better quantitative understanding of the physical mechanics at play in ice melting in salty water, we numerically investigate the lateral melting of an ice block in stably stratified saline water. The developing ice shape from our numerical results shows good agreement with the experiments and theory from Huppert & Turner (J. Fluid Mech., vol. 100, 1980, pp. 367–384). Furthermore, we find that the melt rate of ice depends non-monotonically on the mean ambient salinity: it first decreases for increasing salt concentration until a local minimum is attained, and then increases again. This non-monotonic behaviour of the ice melt rate is due to the competition among salinity-driven buoyancy, temperature-driven buoyancy and salinity-induced stratification. We develop a theoretical model based on the force balance which gives a prediction of the salt concentration for which the melt rate is minimal, and is consistent with our data. Our findings give insight into the interplay between phase transitions and double-diffusive convective flows.