From AMS Glossary
In its more or less original form, light travels between two points in the least possible time.
More correctly, the path taken by a light ray between two points in an optically homogeneous media is such that the line integral along the path,
where n is the refractive index, is an extremum (a minimum or a maximum or even stationary) relative to all possible paths. Because n is inversely related to phase velocity, this integral is proportional to a time, the constant of proportionality being the free-space speed of light. Fermat was guided by a "metaphysical principle that nature performed its actions in the simplest and most economical ways."
Sabra, A. I. 1967. Theories of Light: From Descartes to Newton. p. 136.