[5][6] In the post-Gupta period, Sthanishvara was the capital of the Vardhana dynasty, which ruled over a major part of North India during the late-sixth and early-seventh centuries.
In the following years, he conquered much of North India, extended to Kamarupa, and eventually made Kannauj his capital, and ruled until 647 CE.
[3][5][7] Thanesar is listed in the Ain-i-Akbari as a pargana under the sarkar of Sirhind, producing a revenue of 7,850,803 dams for the imperial treasury and supplying a force of 1500 infantries and 50 cavalries.
[8] Majority of architectural remains including Karavan serai, cells, and various arched and vaulted structures date from the Mughal period.
Building remains of a large palatial structure from the pre-Islamic era were also found with two distinct phases of construction which exposed brick covered drains and rooms situated around a central courtyard.
"[11]Firishta records[12] that In the year A.H. 402 (A.D. 1011) Mehmood Gazini resolved on the conquest of Thanesur, the most sacred Hindu place, in the kingdom of Hindoostan.
It had reached the ears of the King that Thanesar was held in the same veneration by idolaters, as Mecca by the faithful; that they had there set up a number of idols, the principal of which they called Jugsoma, pretending that it had existed ever since the creation.
About the attack on Thanesar, Utbi wrote "The blood of the infidels flowed so copiously that the stream was discoloured, notwithstanding its purity, and people were unable to drink it.
The Sthaneshwar Mahadev Temple is believed to be the place where the Pandavas and Krishna prayed to Shiva and received his blessings for victory in the battle of Mahabharata.