Turkic Migrations

In the first millenium C.E., the Turks had spread outward from the Altays. Those that moved west passed through Kazakhstan. These included the Huns(1), the Bulgars(2) and the Turks(3). An offshoot of the Kyrgiz(4), the Kazakhs, also moved west but--though they ranged further--most of them stayed in Kazakhstan and what is now the Southern Federal District of Russia. Their original religion was probably similar to other Turks--worshipping Tangri, the sky god, for example--but they converted to Islam gradually after flirting with other institutional religions; the process was completed in the 19th century.

Footnotes

(1) Their language affiliation is judged on the basis of a Chinese transcription of a fourth century inscription.
(2) Chuvash speakers, not Bulgarian speakers.
(3) Ancestors of the Turks, Turkmen and Azeri.
(4) Or Kirgiz. They moved southwest across eastern Kazakhstan sometime after the eighth century.