The temple was built by king Shankaravarman (883–902). His father Avantivarman had established the Utpala dynasty and after his death in 883 his son succeeded him. He built the temple in his capital city, then known as Shankarapattana, which is the present-day Patan,  away from Srinagar city, the capital of Jammu and Kashmir.
The temple was constructed by King Shankaravarman (883–902). His father, Avantivarman, founded the Utpala dynasty, and after his death in 883, Shankaravarman took over as ruler. He built the temple in Shankarapattana, which is now Patan, a city located away from Srinagar, the capital of Jammu and Kashmir.