It was founded in 1067 and existed during both the medieval Kingdom of Poland and of the great Polish–Lithuanian Commonwealth.