Kraków's early history begins with evidence of a Stone Age settlement on the present site of the Wawel Hill. A legend attributes Kraków's founding to the mythical ruler Krakus, who built it above a cave occupied by a dragon, Smok Wawelski. The first written record of the city's name dates back to 965, when Kraków was described as a notable commercial centre controlled first by Moravia (876–879), but captured by a Bohemian duke Boleslaus I in 955. The first acclaimed ruler of Poland, Mieszko I, took Kraków from the Bohemians and incorporated it into the holdings of the Piast dynasty towards the end of his reign.