The earliest trees were tree ferns, horsetails and lycophytes, which grew in forests in the Carboniferous period. The first tree may have been Wattieza, fossils of which have been found in New York State in 2007 dating back to the Middle Devonian (about 385 million years ago). Prior to this discovery, Archaeopteris was the earliest known tree. Both of these reproduced by spores rather than seeds and are considered to be links between ferns and the gymnosperms which evolved in the Triassic period. The gymnosperms include conifers, cycads, gnetales and ginkgos and these may have appeared as a result of a whole genome duplication event which took place about 319 million years ago. Ginkgophyta was once a widespread diverse group of which the only survivor is the maidenhair tree Ginkgo biloba. This is considered to be a living fossil because it is virtually unchanged from the fossilised specimens found in Triassic deposits.
During the Mesozoic (245 to 66 million years ago) the conifers flourished and became adapted to live in all the major terrestrial habitats. Subsequently, the tree forms of flowering plants evolved during the Cretaceous period. These began to displace the conifers during the Tertiary era (66 to 2 million years ago) when forests covered the globe. When the climate cooled 1.5 million years ago and the first of four ice ages occurred, the forests retreated as the ice advanced. In the interglacials, trees recolonised the land that had been covered by ice, only to be driven back again in the next ice age.