The Sun Temple was built by Rushabh Bhimdev I of Solanki Dynasty in AD 1026. This was the time when Somnath and the adjoining area was plundered by Mahmud Ghazni and reeled under the effects of his invasion. The Solankis, however, regained much of their lost power and splendour. Anahilvad Patan, the Solanki capital, was restored to glory. Royalty and traders jointly contributed to build grand temples.
Solankis were considered to be Suryavanshi, Gurjar or descendants of Sun God. The temple was so designed that the first rays of the sun fell on the image of Surya, the Sun God, at the time equinoxes.
The temple is partially in ruins after it was also finally destroyed by the Allauddin Khilji.
However, enough has remained of the temple to convey its grandeur.
http://www.raotravelservices.com