An anapsid is an amniote whose skull does not have openings near the temples. Traditionally, the Anapsida are the most primitive subclass of reptiles, the ancestral stock from which Synapsida and Diapsida evolved, making anapsids paraphyletic. It is however doubtful that all anapsids lack temporal fenestra as a primitive trait, and that all the groups traditionally seen as anapsids truly lacked fenestra.
While "anapsid reptiles" or "anapsida" were traditionally spoken of as if they were a monophyletic group, it has been suggested that several groups of reptiles that had anapsid skulls may be only distantly related. Scientists still debate the exact relationship between the basal (original) reptiles that first appeared in the late Carboniferous, the various Permian reptiles that had anapsid skulls, and the Testudines (turtles, tortoises, and terrapins). However, it was later suggested that the anapsid-like turtle skull may be due to reversion rather than to anapsid descent. The majority of modern paleontologists believe that the Testudines are descended from diapsid reptiles that lost their temporal fenestrae. More recent morphological phylogenetic studies with this in mind placed turtles firmly within diapsids, some place turtles as a sister group to extant archosaurs or, more commonly, within Lepidosauromorpha.
All molecular studies have strongly upheld the placement of turtles within diapsids; some place turtles within Archosauria, or, more commonly, as a sister group to extant archosaurs. However, one of the most recent molecular studies, published on 23 February 2012, suggests that turtles are lepidosauromorph diapsids, most closely related to the lepidosaurs (lizards, snakes, and tuataras).
Reanalysis of prior phylogenies suggests that they classified turtles as anapsids both because they assumed this classification (most of them were studying what sort of anapsid turtles are) and because they did not sample fossil and extant taxa broadly enough for constructing the cladogram. Testudines were suggested to have diverged from other diapsids between 200 and 279 million years ago, though the debate is far from settled. Most of the other reptiles with anapsid skulls, including the millerettids, nycteroleterids, and pareiasaurs, became extinct in the late Permian period by the Permian-Triassic extinction event. But the procolophonids managed to survive into the Triassic.
Despite the molecular studies, there is evidence that contradicts their classification as diapsids. Firstly, all known diapsids are uricotelic, meaning they excrete uric acid as nitrogenous waste, and there is no known case of a diapsid re-evolving ureotelism, or the excretion of urea, even when they return to semi-aquatic lifestyles. Crocolilians, for example, are still uricotelic, although they are also partly ammonotelic, meaning they excrete some of their waste as ammonia. Ureotelism appears to be the ancestral condition among primitive amniotes, and it is retained by mammals, which likely inherited ureotelism from their synapsid and therapsid ancestors. Ureotelism therefore would suggest that turtles were more likely anapsids than diapsids. The only known uricotelic chelonian is the desert tortoise, which likely evolved it recently as adaptation to desert habitats recently. Some desert mammals are also uricotelic, but since practically all known mammals are ureotelic, the uricotelic mammals may have converged on the desert tortoise. Therefore, turtles would have to be the only known case of a uricotelic reptile reverting to ureotelism. Secondly, the oldest known turtle, Odontochelys, displays no evidence of any skull openings. That means turtles would have to lose their skull openings without a trace before Odontochelys appeared. That also means there is absolutely no evidence to support the assumption that any turtle has ever had any skull openings at all. Physiological and fossil evidence therefore would make it rather unlikely that turtles were diapsids.
Anapsida is still sporadically recognized as a valid group, but this is not favoured by current workers. Anapsids in the traditional meaning of the word are not a clade, but rather a paraphyletic group composed of all the early reptiles retaining the primitive skull morphology, grouped together by the absence of temporal openings. Gauthier, Kluge and Rowe (1988) attempted to redefine Anapsida so it would be monophyletic, defining it as the clade containing "extant turtles and all other extinct taxa that are more closely related to them than they are to other reptiles".
This definition explicitly includes turtles in Anapsida; because the phylogenetic placement of turtles within Amniota is very uncertain, it is unclear what taxa, other than turtles themselves, would be included in such defined Anapsida, and whether its content would be similar to the Anapsida of tradition. Indeed, Gauthier, Kluge and Rowe (1988) themselves included only turtles and Captorhinidae in their Anapsida, while excluding the majority of anapsids in the traditional sense of the word from it.
Tsuji and Müller (2009) noted that the name Anapsida implies a morphology (lack of temporal openings) that is in fact absent in the skeletons of a number of taxa traditionally included in the group. A temporal opening in the skull roof behind each eye, similar to that present in the skulls of synapsids, has been discovered in the skulls of a number of members of Parareptilia (the clade containing most of reptiles traditionally referred to as anapsids), including lanthanosuchoids, millerettids, bolosaurids, some nycteroleterids, some procolophonoids and at least some mesosaurs. The presence of temporal openings in the skulls of these taxa makes it uncertain whether the ancestral reptiles had an anapsid-like skull as traditionally assumed or a synapsid-like skull instead.