In many episodes of Star Trek, planets are often described as M-class or Minshara-class planets.  In Starfleet's planetary classification, an M planet was characterized by an abundance of surface water and an atmosphere high in nitrogen, with oxygen and trace elements - and hence capable of supporting  extensive vegetation, animal life, and humanoid species. In the episode "Balance of Terror" of the original series, it was theorized that there was a mathematical probability of three million Earth-type planets.

In real astronomy, the probability of M-class planets is actually determined by the presence of planets in the habitable zone (HZ) - a region of space where conditions are favorable for the creation of life. There are two regions that must be favorable, one within a solar system and the other within the galaxy. Planets and moons in these regions are the likeliest candidates to be habitable and thus capable of bearing extraterrestrial life. Astronomers believe that life is most likely to form within the circumstellar habitable zone (CHZ) within a solar system, and the galactic habitable zone (GHZ) of the larger galaxy. The HZ is also be referred to as the "Goldilocks Zone" (because it's neither too hot nor too cold, but "just right").

The circumstellar habitable zone (or ecosphere) is a notional spherical shell of space surrounding stars where the surface temperatures of any planets present might maintain liquid water - water is vital because of its role as the solvent needed for biochemical reactions.  The CHZ of a particular star is "centered" on a distance determined by the equation dAU = SQRT (Lstar/Lsun), where dAU is the mean radius of the HZ in astronomical units, Lstar is the bolometric luminosity of the star, and Lsun is the bolometric luminosity of the Sun.

The location of a solar system within the galaxy must also be favorable to the development of life, and this leads to the concept of a galactic habitable zone. To harbor life, a solar system must be close enough to the galactic center that a sufficiently high level of heavy elements exist to favor the formation of rocky planets. Heavier elements must be present, since they form complex molecules of life, such as iron as the foundation for hemoglobin and iodine for the thyroid gland. In our galaxy (the Milky Way), the GHZ is currently believed to be a slowly expanding region approximately 25,000 light years (8 kiloparsecs) from the galactic core, containing stars roughly 4 billion to 8 billion years old.




As heavy elements spread through the Galaxy,
terrestrial planets are formed and a habitable zone emerges and broadenes (shown in green)