The town of Pernik became part of the Bulgarian kingdom in 809 AD during Khan Krum's reign. The ceding of the territory to Bulgaria was legitimized by a peace treaty of 815 AD between Khan Omourtag and the Byzantine Empire. It was in the life chronicle of St. John of Rila that the settlement was mentioned for the first time in the Middle Ages - the desert dweller "went to Pernik and settled in a place-made of stone near a river, called Struma and there he made a quiet home of his own". St. John of Rila* is the principal patron saint of Bulgarians and a protector of miners.
*Saint John of Rila - was the first Bulgarian hermit. He was revered as a saint while he was still alive. The legend surrounding him tells of wild animals that freely came up to him and birds that landed in his hands. Today, he is honored as the patron saint of the Bulgarians and as one of the most important saints in the Bulgarian Orthodox Church. - https://en.wikipedia.org/wiki/John_of_Rila
You are very welcome to see few photos from this event: