I know the embryos of most animals develop into 3 germ layers. However primitive animals, such as Cnidarians, only have 2 germ layers - they lack a mesoderm. Therefore the 3rd germ layer must have evolved from cells which originally differentiate to one of the two more basal germ layers.
So my question is - does the mesoderm evolve from the ectoderm or the endoderm? Meaning, during embryogenesis, which cell type is the first to differentiate from the other two - the ectoderm or the endoderm?