The Medieval Period in India starts with the Turkish invasion. With the death of Harshvardhana, an era of feudalism rose in India. There was a lot of political disheveling in the north India and everyone was too busy capturing small kingdoms than to take notice of the aggressive invasion of the Turks. The Turkish invasion in India took place around the 11th century with the Mahmud of Ghazni raiding the country all the way from Afghanistan. He gained his victory against the Hindushahi kings of Peshawar. The next targets were the Muslim rulers of Multan.
Mahmud of Ghazni plundered India 17 times in a short time span of around 25 years and looted India off its wealth and resources. The areas around Gujarat and Kannauj were rich and prosperous and were looted mercilessly by Mahmud. This wealth helped him consolidate his hold and power over northern India. He made many palaces and mosques with the looted wealth in Ghazni located in central Asia. After plundering India many times, he finally died in Ghazni in 1030 A.D.
The Rajput kings were fighting among themselves for the possession of princely states during the 11th and 12th centuries. They seized every slight opportunity to engage wars against each other. This was also the time when Prithviraj rose to power and married the daughter of the king Jaichand of Kannauj by abducting her from the middle of her wedding. At this time, Mohammed Ghori was planning to invade India and the Rajput king thought he just wanted to loot India and go back. Thus, he decided to become an ally of Mohammed Ghori and help him defeat Prithviraj.
But when he came to know that Ghori wanted to establish a kingdom here, he half heartedly joined Prithviraj along with other Rajput kings and together they were able to defeat Mohammed Ghori. But Prithviraj let him go when Ghori appealed to him. However, the very next year the Afghans launched another attack on Prithviraj and defeated him badly at the war. Ghori however, did not set Prithviraj free and the kingdoms of Prithviraj went in the hands of Qutub-ud-din. With the conquest of Mohammed Ghori, India saw for the first time a proper dynastic rule.