Ammonites first appeared in the early Devonian period. They evolved from a small, straight shelled Bactridian, which was an early Nautiloid. They quickly evolved into a variety of shapes and sizes, including some shaped like hairpins. During their evolution the ammonites faced no fewer than four catastrophic events that would eventually lead to their extinction. The first event occurred in the Upper Devonian, and the second at the end of the Permian (250 million years ago), when only two lines survived the P/Tr extinction event. The surviving species radiated and flourished throughout the Triassic perod. At the end of this period (206 million years ago) they faced near extinction again, when only one genus survived. This event marked the end of the Triassic and the beginning of the Jurassic, during which time the number of ammonite species grew once more. The final catastrophe occurred at the end of the Cretaceous period when all species were annihilated and the ammonites became extinct.