MainSnakes are among the most diverse vertebrates today, with over 4,200 extant species representing one-third of squamate diversity (http://www.reptile-database.org). Their long evolutionary history, dating back to at least the Middle Jurassic3, and highly modified body plan have long sparked debate over their phylogenetic and ecological origins1,2. Despite recent advances in phylogenetic and macroevolutionary methods, along with growing agreement between molecular and morphological hypotheses of squamate systematics4,5,6, uncovering the origin of snakes remains challenging due to their poor fossil record and profound anatomical transformations that accompanied their ecological diversification1.To date, fewer than 10 articulated snake fossils are known from the Mesozoic, of which only three are three-dimensionally (3D) preserved: Dinilysia patagonica and Najash rionegrina from Argentina7,8,9 and Sanajeh indicus from India10. These fossils underpin much of our understanding of early snake evolution1,2, including their placement within the squamate Tree of Life and hypotheses about limb reduction and body elongation. However, they leave unresolved one of the most contested questions in vertebrate evolution: whether the earliest snakes evolved in marine11,12,13, fossorial (for example, burrowing)14,15,16,17,18 or terrestrial19 environments. Furthermore, the scarcity of well-preserved fossils has constrained interpretations of sensory evolution, leaving key aspects of stem snake palaeobiology—such as how their brains adapted to various lifestyles20,21—largely unexplored, despite the close relationship between brain organization, function and ecological demands20,21.Here we report a new 3D-preserved stem snake species from the Late Cretaceous, represented by both skull and postcranial material recovered from a recently discovered locality in southeastern Brazil22 (Fig. 1a–j). Previously known Cretaceous snakes from Brazil, such as Seismophis23 and Boipeba24, are based only on isolated vertebrae, making Tametara, to our knowledge, the first articulated Brazilian snake fossil. Its exceptional preservation and high-resolution micro-CT scanning provide the most detailed reconstruction of a stem snake brain endocast to date and novel insights into snake skull evolution. Combining geometric morphometrics and bone microstructure analyses, we show that this specimen represents an unambiguous, quantitatively supported case of fossoriality in a stem snake, highlighting early ecological experimentation during snake evolution.Fig. 1: Holotype (MPM 420) of T. mirim.a, Photograph of the whole specimen with the articulated skull and postcranium in dorsal view. Ant, anterior; Bl, block number; Ce.V., cervical vertebrae; Do.V., dorsal vertebrae; Post, posterior; Sk, skull. b,c, Photographs of the skull in lateral (b) and dorsal (c) view. CB, compound bone; F, frontal; Oto, otoccipital; P, parietal; PFr, postfrontal; Pro, prootic; Ptg, pterygoid; Q, quadrate; Soc, supraoccipital; St, supratemporal. d–g, 3D renderings of an anterior precloacal (‘cervical’) vertebra in lateral (d) and anterolateral (e) views, and mid-precloacal (‘dorsal’) vertebra in dorsal (f) and left lateral (g) views. h–j, 3D renderings of the skull in the right lateral view (h) and with exposed brain endocasts in the right lateral (i) and dorsal (j) views. Mes., mesencephalon; Rho., rhombencephalon; Tel., telencephalon. Scale bars, 100 mm (a), 5 mm (b,c,h–j) and 1 mm (d–g). Specimen photos were taken by A.S.H.Systematic palaeontologySquamata Oppel, 1811Serpentes Linnaeus, 1758Tametara mirim gen. et sp. nov.Etymology. Tametara, meaning ‘adorned’ (referring to the pronounced sagittal crest of the holotype); mirim, meaning small-sized, in the native Brazilian, Tupí-Guaraní language.Holotype. MPM 420 (Museu de Paleontologia de Marília, Marília, State of São Paulo, Brazil). Posterior half of a 3D-preserved skull and mandibles articulated with the anterior portion of the postcranium, including 103 presacral vertebrae (Figs. 1 and 2 and Extended Data Figs. 1 and 2).Locality and age. The fossil was discovered by W.R.N. and G.M.X.P. in 2020, in William’s Quarry 2 at Sítio Paleontológico ‘José Martin Suárez’ (Presidente Prudente municipality, State of São Paulo, Brazil); Adamantina Formation, Bauru Group, Bauru Basin, late Santonian to early Campanian age (approximately 85–75 million years ago (Ma))22.Diagnosis. T. mirim can be distinguished from all other snakes based on the following combination of characters: postfrontal present but parietal (posterior) process absent*; parietal with posteromedial process present*; supraoccipital with sagittal crest, posterolaterally projecting nuchal crests*, well-developed anterolateral processes* and strongly overlapped by the parietal dorsally; otoccipitals not contacting each other medially (separated by posterior process of supraoccipital); quadrates with quadrate conch, suprastapedial process and pterygoid lappet; posterior surangular foramen present; precloacal vertebrae with well-developed and ventrolaterally oriented zygosphenes and zygantra, presence of midventral keel*, short neural spines and parazygantral foramina; dorsal vertebrae with subcentral and paracotylar foramina; olfactory bulbs longitudinally short; and cerebral hemispheres mildly enlarged. Features highlighted with an asterisk (*) represent phylogenetically inferred autapomorphies (Fig. 3 and Extended Data Figs. 3–6) listed in Supplementary Information. For differential diagnosis with N. rionegrina and D. patagonica, see Supplementary Table 1.Ontogeny. The holotype is interpreted as an adult based on the high degree of ossification of cranial elements, strong overlap between the supraoccipital, parietals and prootics25, well-developed vertebral condyles and zygosphenes, and a relatively small neural canal26.Osteological descriptionHere we provide an overview of the most remarkable aspects of the comparative anatomy of T. mirim. A full description is provided in Supplementary Text and CT data are provided in Supplementary Data 1.The holotype and only known specimen of T. mirim (MPM 420) includes an articulated cranium and postcranium exposed in dorsal view with its ventral side embedded in a sandstone matrix (Fig. 1a–c). Specimen size is relatively small, with a preserved skull length of 17.8 mm (predicted total skull length of approximately 33 mm) and total preserved body size of 419 mm. Therefore, Tametara is intermediate in skull size, relative to the extant Cylindrophis ruffus (skull length of 29.16 mm) and Xenopeltis unicolor (skull length of 36.33 mm). The posterior half of the skull is almost perfectly preserved, including parts of the dermatocranium (postfrontal, frontal, parietal, supratemporals and right pterygoid), splanchnocranium (quadrates) and neurocranium (supraoccipital, otoccipitals, prootics, basioccipital and parabasisphenoid; Fig. 2a–e and Extended Data Fig. 1a–f).Fig. 2: Segmented skeletal and encephalic structures derived from micro-CT scanning of the holotype (MPM 420) of T. mirim.a–e, Segmented bones of the skull (from micro-CT scans) in the left lateral (a), right lateral (b), posterior (c), dorsal (d) and ventral (e) views. A.San.Fr., anterior surangular foramen; Al.Pr., alar process of prootic; Am.Pr., anteromedial process of parietal; Boc, basioccipital; Bsp, basisphenoid; Bsp.Pr., basisphenoid process; C, coronoid; CN, cranial nerve; Fn.Ov., fenestra ovalis; Pa.Des., parietal descending process (descensus parietalis); Pm.Pr., posteriomedial process; P.San.Fr., posterior surangular foramen; Sub.Pr., subolfactory process of frontal; Sg.Cr., sagittal crest; St.Pr., supratemporal process of parietal; Sta, stapes; Sta.Pr., suprastapedial process of quadrate; Ty.Cr., tympanic crest of quadrate. f–h, Segmented anteriormost presacral (cervical) vertebrae in posterodorsal (f), ventral (g) and left lateral (h) views. Ce.I., cervical intercentrum; Ce.R., cervical rib; Hy, hypapophysis; Mg.L., margo lateralis; Mg.V., margo ventralis; Mid.Cr., midventral crest (haemal keel); N.A., neural arch; N.S., neural spine; PaDi, para-diapophysis; Poz, postzygapophysis; Prz, prezygapophysis; Sub.Fr., subcentral foramen; Syn, synapophisis; V.Con., vertebral condyle; Zga, zygantrum; Zyg, zygosphene. i, Segmented mid-presacral (dorsal) vertebrae in left lateral view. j, Endocasts of brain, cranial nerves and the inner ear in anterolateral view. A.Scc., anterior semicircular canal; CC, common crus; Cer.H., cerebral hemisphere; Ch.P., choroid plexus; H.Scc., horizontal semicircular canal; Med.Ob., medulla oblongata; Olf.B., olfactory bulb; Opt.T., optic tectum; Pit, pituitary region; P.Scc., posterior semicircular canal; Vest, vestibule. Scale bars, 5 mm.The postfrontal has a distinct frontal (that is, anterior) process and a distal process oriented ventrally, as in other stem snakes such as Dinilysia and Najash7,8,9. Unlike these taxa, however, it lacks a distinct parietal (that is, posterior) process (Figs. 1c and 2d). The supratemporals of Tametara are elongated longitudinally and lack the free ending posterior process of most crown snakes (Fig. 2a–e). Moreover, the supratemporal lacks the mid-shaft lateral bulge seen in Dinilysia7,8. The quadrate is strongly posteriorly emarginated and bears a well-developed suprastapedial process, as in Najash and Dinilysia, but unlike simoliophiids and crown snakes (Figs. 1b and 2a–c and Extended Data Fig. 1a). As in Dinilysia, Tametara has a shallow quadrate conch, which is absent in Najash.Part of the right frontal is preserved, with a smooth medial border indicating articulation with its contralateral pair and lack of fusion (Figs. 1b and 2a,d,e). The parietal is unpaired and bears a well-developed sagittal crest extending longitudinally along its dorsal surface and posteriorly over the supraoccipital (Figs. 1b and 2a–d). There is no indication of anterolateral processes, as seen in most stem and crown snakes. However, the parietal has a short anteromedial process that would have inserted between the frontal sections (Fig. 2d). This process is absent in Najash, arguably present in Dinilysia, where the parietal contacts the frontal sections in a W-shaped interdigitating suture7,8,9, and more clearly occurring in the Australian madtsoiid Wonambi27. The posterolateral margins of the parietal form supratemporal processes (that is, postparietal processes), which occur in a few other stem snakes (for example, Najash, Dinilysia and Sanajeh7,8,9,10) but are absent in most crown snakes (Figs. 1b and 2a,b,d). However, unlike other stem snakes with a preserved posterior parietal margin, Tametara has a well-developed posteromedial process that slots into the anteromedial margin of the supraoccipital (Figs. 1b and 2a,b,d). In lateral view, the parietal descending flange overlaps the prootic crest medially (Fig. 2a,b) and lacks a ‘medial parietal pillar’, which typically separates the telencephalon and mesencephalon28, as in Dinilysia, Najash and scolecophidians (blind snakes).The supraoccipital bears well-developed anterolateral processes that contact the parietal and are strongly overlapped by it posterolaterally (Fig. 2a,b,d and Extended Data Fig. 1b,f), similar to the Australian madstoiid Yurlunggur29. Comparable supraoccipital overlap occurs in other snakes, but the extent of overlap with the parietal and prootics is greater here than in any extant snake species known to us and most fossil snakes. Accordingly, the dorsally exposed supraoccipital occupies a greater proportion of the preserved skull roof in Tametara (approximately 25%) than in adult Dinilysia specimens (8–11% in MACN-Pv RN1013 and MLP 26-410, respectively). A comparable degree of overlap is only known in Najash9 among all stem snakes assessed here.The braincase of Tametara illustrates several plesiomorphic snake conditions resembling the morphology of non-ophidian squamates. For instance, the otoccipitals do not meet at the midline, being completely separated from each other by the posteromedial process of the supraoccipital (Figs. 1c and 2c–e). This configuration is widespread among non-ophidian squamates and was previously known unambiguously among snakes only in Najash9; Haasiophis displays separation between the otoccipitals in dorsal view30,31, but it is currently unknown whether they meet ventrally to the supraoccipital. A crista circumfenestralis (refer to ref. 32) is also absent (Fig. 2a and Extended Data Fig. 1a), another plesiomorphic condition occurring among other stem snakes such as Najash, Dinilysia, Yurlunggur, Wonambi and Sanajeh32,33 (and T.R.S., unpublished observation). Furthermore, the pila antotica (that is, laterosphenoid), which encloses the trigeminal notch anteriorly in alethinophidians, is unossified, as in Najash, Dinilysia, Yurlunggur, Wonambi, Sanajeh and scolecophidians among crown snakes.The posterior portions of both compound bones are present, with the right element better preserved (Figs. 1b,c and 2a–e and Extended Data Fig. 1h). A posterior surangular foramen also occurs, as in many stem snakes but unlike most crown snakes (Fig. 2d and Extended Data Fig. 1h). The retroarticular process is absent in Tametara, as in Dinilysia (T.R.S., unpublished observation, but see alternative interpretations7,8), whereas Najash exhibits a small one. A small coronoid fragment is preserved as a dorsal process just anterior to the mandibular fossa (Fig. 2d and Extended Data Fig. 1h).The postcranium preserves at least the anterior half of the vertebral column (except atlas and axis), represented by approximately 103 precloacal vertebrae (Fig. 1a). All vertebrae possess a depressed neural arch, except for the anteriormost cervicals, low blade-like neural spines, well-developed zygosphenes and zygantra, a midventral ridge (that is, haemal keel), subcentral and paracotylar foramina, and parazygantral pits/foramina (Figs. 1d–g and 2g,h and Extended Data Fig. 2a–c). Margo ventralis and margo lateralis are developed in the preserved dorsal series, but their expression varies along the column; we therefore treat them as informative but not standalone diagnostic characters for Tametara. Forelimbs are interpreted as absent based on specimen articulation, preservation and micro-CT scanning, although poor rib preservation prevents complete exclusion. Hindlimb presence cannot be assessed because the cloacal region is not preserved.Brain and inner ear descriptionEndocast–brain correspondence in squamates varies across regions but in snakes it is generally very close in the forebrain, especially the telencephalon and olfactory bulbs28,34. Endocast morphology therefore provides a useful proxy for quantitative comparisons among extant snakes28,34 and has also helped to assess fossil taxa, informing interpretations of brain ecomorphology28 and phylogenetic comparisons among fossil squamates21,22,28,35. We used high-resolution micro-CT scans and the SmARTR pipeline36 for cinematic rendering to reconstruct brain and inner ear endocasts for Tametara and Dinilysia, the only stem snakes with publicly available, well-preserved braincases, integrating qualitative neuroanatomy with quantitative telencephalon morphometrics.The brain endocast of Tametara is anteroposteriorly elongated and anteriorly defined by short olfactory bulbs (Figs. 1i,j and 2j and Extended Data Fig. 1i–k). Although parts of the anterior frontal region are incomplete, the preserved morphology supports our interpretation of the frontal–endocast relationship (Extended Data Figs. 7 and 8); comparisons are therefore restricted to structures that can be confidently delimited. The olfactory bulbs transition posteriorly into mildly enlarged cerebral hemispheres, followed by a slightly narrower mesencephalon, similar in proportion to Cylindrophis (Extended Data Fig. 7). This differs from many squamates, including numerous snakes, in which expanded cerebral hemispheres contrast strongly with the mesencephalon and rhombencephalon (that is, mid-hindbrain and hindbrain, respectively)34,37,38. However, similar proportions are also observed in several taxa, particularly fossorial species and, to some extent, larger-bodied forms34,37,38 (Extended Data Fig. 7). Accordingly, the telencephalon of Tametara resembles fossorial species, including scolecophidians (for example, Liotyphlops), Uropeltis39, Blanus and Melanoseps34 (Extended Data Fig. 7).In the diencephalon, the posterior portion of the pituitary region is notably large (Fig. 2j and Extended Data Fig. 1j), tilting strongly ventrally towards the hypophyseal fossa of the basisphenoid. Among extant snakes, fossorial species generally do not show a markedly long pituitary, whereas marine and terrestrial forms tend to exhibit a more ventrally developed gland34,37,38.The mesencephalon of Tametara is posteriorly elongated and has a poorly defined optic tectum (that is, optic lobe). Among extant snakes, the most similar condition to Tametara is seen in Cylindrophis37,39 (Figs. 1i,j and 2j and Extended Data Fig. 1i–k). Squamate species with higher degrees of fossoriality, nocturnal habits or living in aquatic murky environments also tend to have poor development of the optic tectum, which contributes to reduced mesencephalon resolution in their endocasts34,37,38.The rhombencephalon of Tametara has a strongly dorsally projecting hourglass-shaped region (Fig. 2j and Extended Data Fig. 1i,j), similar to Anilius scytale and Dinilysia28. In snake endocasts, this feature has been associated with either the choroid plexus of the fourth ventricle28 or unknown structures28. The remaining rhombencephalon is separated from the anterior region by the approximating contralateral common crura (Fig. 2j and Extended Data Fig. 1g), and its mostly flat morphology indicates that the medulla oblongata is not as expanded as in most extant snakes28,34. In dorsal view (Extended Data Fig. 1i), the medulla is narrower than the cerebral hemispheres, but it has a similar width to the optic tectum. The long, poorly arched medulla is not typical of fully fossorial squamate species28,34.In the inner ear, the vestibular region of the otic capsule is enlarged, occupying most of the prootic and otoccipital bones (Fig. 2c,j and Extended Data Fig. 1b,i–k), a common feature in burrowing snakes40. The separation between saccular and utricular recesses is visible on the posterior surface of the prootic (Fig. 2c and Extended Data Fig. 1b). The lagenar recess appears wider anteriorly than posteriorly, although this may reflect otoccipital damage. The anterior ampullary recess is small, but in contrast to Dinilysia17, the anterior and lateral ampullae are indistinguishable. The posterior ampullary recess and common crus are highly reduced, matching the simplified semicircular canal architecture of fossorial snakes40. The anterior and posterior canals meet dorsomedially near the utricular area, nearly merging with the vestibular endocast. The endolymphatic foramen lies anteroventral to the common crus, whereas the large perilymphatic foramen opens posteroventrally into the recessus scalae tympani (Extended Data Fig. 1e).Phylogeny and divergence timesWe tested the phylogenetic placement of Tametara using the latest iteration41 of the total evidence dataset of Simões et al.5, comprising 166 fossil and extant species, 394 morphological characters and molecular data from 11 loci with the greatest coverage across taxa (see Methods). We implemented maximum parsimony and Bayesian inference analyses, including non-clock and relaxed-clock approaches, focusing mainly on relaxed-clock results because of their explicit macroevolutionary modelling (see Methods).All analyses support Tametara as a stem snake, with most results identifying Tametara as one of the earliest-diverging snakes, together with Najash from Argentina (Fig. 3 and Extended Data Figs. 3–6). This placement is supported mainly by skull features, including the presence of a dorsum sellae on the basisphenoid (absent in many later-deriving snakes), absence of a mid-sagittal basisphenoid crest (conspicuous among simoliophiids, Wonambi and many early crown snakes) and otoccipitals separated medially by the supraoccipital (plesiomorphic condition otherwise observed exclusively in Najash9). Tametara further differs from crown snakes by retaining the basipterygoid process, foramen chorda tympani and by lacking accessory processes on the prezygapophyses. The margo ventralis and margo lateralis are developed in the preserved dorsal series but are treated cautiously because their expression varies along the column. Its sister relationship with Najash is supported by the presence of a quadrate lappet for the quadrate–pterygoid articulation (see Supplementary Text for a complete list of synapomorphies).Fig. 3: Early snake evolutionary tree depicting placement of T. mirim and major changes in snake brain structure.Summarized results from total evidence dating using the skyline fossilized birth–death tree model and log-normal relaxed clocks. Node values indicate divergence times (top) and posterior probabilities (bottom; in bold). The full tree is displayed in the bottom left inset (snakes highlighted in cyan ellipse) and Extended Data Figs. 6 and 7. Brain endocast renderings for each clade are as follows, from top to bottom: T. mirim gen. et sp. nov. (stem snake), D. patagonica (stem snake), Liotyphlops albirostris (Scolecophidia), A. scytale (Amerophidia), C. ruffus (Uropeltoidea), Python regius (Pythonoidea), Eryx jaculus (Booidea), Crotalus intermedius (Viperidae), Thamnophis sirtalis (Colubroidea) and Boaedon fuliginosus (Elapoidea). Brain subdivisions were mapped from iodine-stained scans in extant specimens and reconstructed based on comparative anatomy in fossils. EC, Early Cretaceous; EJ, Early Jurassic; Eo, Eocene; LC, Late Cretaceous; LJ, Late Jurassic; Mio, Miocene; MJ, Middle Jurassic; Ol, Oligocene; Pal, Palaeocene.Our total evidence dating, using the skyline (episodic) fossilized birth–death model and best-fit relaxed-clock model, corroborates a Middle Jurassic origin of snakes and an early Late Cretaceous origin of crown snakes9,42. It also places all robust-limbed fossil snakes on the snake stem, implying a single early loss of hindlimbs9. Conversely, despite explicitly incorporating novel information on the presence of upper temporal bar elements in the stem snake Sanajeh10, the latter is still recovered crownwards of Najash and Tametara (Fig. 3 and Extended Data Figs. 3–6). This placement implies homoplastic evolution of the upper temporal bar in early snakes: either three independent losses or a reversal to the plesiomorphic condition in Sanajeh. Elements of the upper temporal and postorbital bar are highly homoplastic across squamate evolution, including snakes1,2,10, and, as with limb evolution9, fully resolving the sequence of upper temporal bar loss in snakes will require further scrutiny, ideally aided by additional well-preserved stem fossils.Early evolution of snake brainsWe used a standardized protocol for geometric morphometric (GMM) analysis with 3D landmarking (3D GMM) of squamate brain endocasts43, including extant and fossil taxa (Tametara and the well-preserved, publicly available Dinilysia), to investigate early snake brain evolution (Fig. 4a and Extended Data Figs. 7 and 8). The broad phylogenetic coverage and diverse life habits sampled allowed us to test associations between brain endocast shape and habitat preference using phylogenetically informed statistical methods (see Methods). Although broad non-snake squamate sampling may influence morphospace structure, it provides essential comparative morphological and ecological context for interpreting fossil snake brain shape. Our 3D GMM focused on telencephalon shape, as it is less affected by taphonomic distortion in the two fossils, and constitutes a discrete, functionally coherent anatomical unit that is highly conserved and more faithfully represented in snake endocasts than in posterior brain regions21.Fig. 4: Phylomorphospace of the snake telencephalon and bone microstructure by habitat preference, including the fossil stem snakes T. mirim and D. patagonica.a, Phylomorphospace representing the telencephalon shape distribution of snakes (squares) and other squamates (circles) with different habitat modes (see colour code and symbols in the legend). A total of 58 extant squamate and two fossil snake species (marked with asterisk) are included (n = 60 species). The percentages indicate the proportion of total variance explained by each principal component axis. Full endocast reconstructions, with the telencephalon highlighted, are shown for the two fossil species (indicated by daggers) and the extant extreme species along each principal component axis. Dashed-line arrows connect the brain endocasts to the respective species names they were extracted from. Additional informative species are shown by name only (for principal component analysis (PCA) with species names, see Extended Data Fig. 9a). b, Phylomorphospace with PCA based on six microanatomical and morphological traits of the squamate skull, quantified from micro-CT scans of 106 extant plus the two fossil species (total n = 108 species). The solid axis arrows indicate the variables contributing to the first and second principal components (PC1 and PC2, respectively), with their lengths scaled to reflect importance along the x and y axes. The dark brown lines indicate several independent acquisitions and reversals between fossorial and non-fossorial snake lifestyles. Key ancestral nodes relative to snake origins are numbered. The green arrows indicate the estimated lizard-to-snake transition (for PCA with species names, see Extended Data Fig. 10). MRCA, most recent common ancestor; RFP, length ratio of frontal and parietal bones. Silhouettes created by T.R.S.Source dataWe found that the earliest known snake telencephalon endocasts of Tametara and Dinilysia occupy widely separated positions along the first principal component in morphospace and lie towards the margins of the squamate phylomorphospace sampled (Fig. 4a and Extended Data Fig. 9a,b). The distance between Tametara and Dinilysia is larger than that of most other snake pairs in our sample. These results indicate that snakes achieved substantial disparity in cerebral hemisphere and olfactory bulb morphology—and presumably function—very early in their evolution, at least by the early Late Cretaceous (approximately 100 Ma).Neither Tametara nor Dinilysia is positioned near the inferred region of morphospace that marks the transition between non-ophidian squamates and snakes (Extended Data Fig. 9b). Instead, the snakes closest to this ancestral node in morphospace are Hydrophis and Micrurus, two phylogenetically derived elapoid species. This suggests a mismatch between transitional skull anatomy in stem snakes9 and patterns of brain endocast shape variation. Our findings align with palaeoneurological evidence that snakes underwent sensory shifts early in their history40, reflecting fast ecological experimentation rather than gradual transition. Moreover, the discrepancy between transitional skull anatomy and divergent brain morphology echoes broader cases of mosaic evolution in vertebrates, including squamate brain evolution linked to locomotor specialization21, and decoupled cranial and neural evolution at the origins of mammals44 and birds22,45.Palaeoecological origin of snakesOur 3D GMM analyses indicate that early snake brain shape reflects ecological variation, particularly between fossorial and non-fossorial species (Fig. 4a and Supplementary Tables 2 and 3). No significant allometric effect was detected, possibly reflecting the conservative landmark configuration adopted here, constrained by fossil preservation and homology requirements. Tametara falls well within the exclusively fossorial region of telencephalon morphospace, being classified as fossorial with 99.2% probability under a linear discriminant model with an overall classification accuracy of 65% (Supplementary Table 4). Although the overall model accuracy is moderate, the associated Kappa value (0.5) indicates that habitat predictions are driven by structured morphological patterns rather than chance. Classification success, however, varies among habitats, with fossorial taxa showing the highest correct classification rate (85.6%) compared with arboreal (60.5%), terrestrial (62.5%) and especially aquatic taxa (22.0%). Consistently, typicality probability analysis further indicates for Tametara the highest morphological affinity with fossorial taxa (57.4%), whereas compatibility with alternative habitats remains very low (less than 2.5%; Supplementary Table 5). Indeed, Tametara represents one of the most extreme squamate examples in this regard (Fig. 4a and Extended Data Fig. 9). These results match comparative anatomical observations, in which Tametara shares with fossorial taxa short olfactory bulbs gently transitioning into poorly differentiated cerebral hemispheres and a reduced optic tectum20,21,34,37,38 (Extended Data Fig. 7). Its elongated mid-hindbrain and large pituitary region—conditions more commonly observed in aquatic, surface-dwelling or semi-fossorial taxa21,22,37,38—highlight a modular pattern of brain evolution, consistent with regionally decoupled trajectories in snake brains21. Inner ear features, including an enlarged vestibular region and simplified semicircular canals, provide independent support for fossoriality. We did not apply 3D GMM on the inner ear because previous studies have yielded contradictory results17,40, suggesting insufficient ecological signal for reliable habitat inference.In contrast to Tametara, the telencephalon of Dinilysia occupies a unique region of morphospace not overlapped by any other squamate group (Fig. 4a and Extended Data Fig. 9). The combination of a dorsoventrally shallow lateral profile, poorly differentiated subdivisions, extremely long and curved olfactory bulbs, and narrow cerebral hemispheres is unlike that of any other squamate quantified here—although showing proportions similar to the ground dwelling Python bivittatus (supplementary figure S3 in ref. 35). Overall, its telencephalon shape is closest to surface-dwelling taxa and, under the same discriminant framework used for Tametara, is predicted to be terrestrial with a probability of 56.7% compared with only 25.7% for fossoriality (Supplementary Table 4). Typicality probability analysis shows the highest compatibility (8.5%) with terrestrial taxa, although all habitat affinities remain low (Supplementary Table 5). Together, these results support a non-fossorial interpretation of Dinilysia, consistent with previous anatomical inferences that have alternatively favoured terrestrial or semi-aquatic habits1,28,40, while also indicating that telencephalon shape alone does not clearly discriminate among non-fossorial lifestyles.Bone microstructure provides independent evidence for ecological inferences from brain morphology. We quantified bone thickness, compactness, overlap and relative proportions, together with cranial elongation and diameter, across early-diverging extant snakes plus the stem taxa Tametara and Dinilysia (Fig. 4, Extended Data Fig. 10 and Supplementary Table 6). These traits are reliable habitat proxies capturing both phylogenetic and functional variation46. We expanded the reference dataset with 14 extant early-evolving snake species and the two stem snakes Tametara and Dinilysia (see Methods).Our bone microstructure analysis separates fossorial and semi-fossorial squamates from non-fossorial forms (Supplementary Tables 7 and 8). Fossorial squamates generally show greater bone compactness, thickness and skull elongation, low frontal:parietal length ratios, moderate-to-high bone overlap and small skull diameter (Extended Data Fig. 10a,b and Supplementary Table 6). Snakes display the most extreme skull elongation and compactness among fossorial squamates, as reflected in the bone microstructure morphospace (Fig. 4b, Extended Data Fig. 10c and Supplementary Table 9), indicating a distinctive cranial configuration not shared with other elongate squamates. Although several squamate families independently evolved snake-like bodies and fossoriality (for example, limbless geckos, skinks, anguids, amphisbaenians and dibamids)47, none converged on the unique combination of skull bone patterns seen in snakes. By contrast, non-fossorial, non-ophidian squamates (that is, ground dwelling or scansorial ‘lizards’) have low bone compactness and shorter skulls, whereas non-fossorial snakes combine moderate compactness and elongation with low bone overlap and large skull diameter (Fig. 4b). Consistent with these trends, Tametara falls within the fossorial snake cluster, whereas Dinilysia lies outside it, indicating a non-fossorial habit (Fig. 4b). These results show that Tametara combined fossorial brain-shape signals with independent cranial microstructural evidence for burrowing.Reconstruction of ancestral bone microanatomy places early snakes within or near the overlap zone between fossorial and non-fossorial squamates (Fig. 4b, green nodes), suggesting a transitional structural profile less specialized for fossoriality than in most crown snakes or stem forms such as Tametara. This zone also includes some scolecophidians, well known for their fossorial lifestyle, whose diverse skull morphotypes occupy disparate positions across squamate and snake morphospaces, as previously noted19,48. Some species show morphologies distinct from other fossorial snakes, including loss of bone connections and low skull roof compactness (Fig. 4b). This cautions against treating extant scolecophidians as straightforward analogues of the ancestral snake condition, as sometimes implied by their phylogenetic placement, and reveals broader cranial diversity than previously appreciated. Furthermore, the broader morphospace distribution highlights multiple independent acquisitions and reversals between fossorial and non-fossorial lifestyles, both among crown snakes and at least once among stem snakes, patterns reflected in both skull structure and brain shape (Fig. 4). Together, these results demonstrate that transitions between distinct ecological niches occurred repeatedly during snake evolution.ConclusionsThe ecological origin of snakes has long been debated, with hypotheses favouring marine, fossorial or terrestrial ancestors1,2,11,12,13,14,15,16,17,18. More recently, however, it has been recognized that the ancestral condition for stem snakes may not necessarily match that of crown snakes19,40. Our results, together with recent findings9, support a long stem history for snakes that encompassed diverse ecologies before the origin of crown snakes. Stem forms were not ecologically uniform: Late Cretaceous lineages included marine simoliophiids12,13, fully fossorial forms (Tametara) and non-fossorial forms (Dinilysia), and which were not necessarily predictive of the ancestral crown snake condition.Snake origins therefore were not shaped by a single, linear event as traditionally thought11,12,13,14,15,16,17,18. Instead, early snake evolution involved repeated shifts in habitat use and sensory ecology, characterizing a dynamic ecological history in which multiple lineages independently explored fossorial and non-fossorial lifestyles within both stem and crown groups. In particular, lifestyle transitions among stem snakes included not only a shift towards surface dwelling, as shown here, but also at least one transition into marine environments represented by Cretaceous simoliophiids30,49. Together, these results provide quantitative, multi-system confirmation of fossoriality in a stem snake, resolving a long-standing debate previously addressed mainly through qualitative analyses or isolated anatomical evidence. More broadly, they highlight that snake origins were shaped not by a single ecological pathway, but by parallel and overlapping experiments in fossoriality and other lifestyles, underscoring the ecological breadth that underpinned one of the most dramatic body-plan transformations in vertebrate evolution.MethodsMicro-CT scanning and digital reconstruction of T. mirim