Castle Rock is a volcanic plug in the middle of Edinburgh upon which Edinburgh Castle sits. The rock is estimated to have formed some 350 million years ago during the early Carboniferous period. It is the remains of a volcanic pipe which cut through the surrounding sedimentary rock, before cooling to form very hard dolerite, a coarser-grained equivalent of basalt. Subsequent glacial erosion was resisted more by the dolerite, which protected the softer rock to the east, leaving a crag and tail formation.