Pieniny mountains formed at the bottom of the sea in several geological epochs. They were folded and raised in Upper Cretaceous. At the beginning of the Paleogene geologic period a second wave of tectonic movements took place causing a further shift. The third wave of movements during the Paleogene and Neogene resulted in a more complex tectonic structure. At the same time erosion resulted in stripping of the outer mantle rocks and further modeling of terrain. Peaks were built from weather resistant Jurassic rocks, mainly limestone. Valleys and passes were created from softer and more susceptible to weathering rocks of Cretaceous and Paleogene periods. Caves are few and rather small. By contrast, rivers and streams are often deeply indented in the rock, creating approximately 15 ravines and gorges. The most famous gorges of the Pieniny mountains are the Dunajec River Gorge in Pieniny National Park and the Homole Ravine (). Hills along the northern border of Pieniny are of volcanic origin.