Describing the situation in India after Mahmud Ghazni’s military expedition, Alberuni says, “Mahmud destroyed the wealth of India. The scars of this attack couldn’t be erased in the minds of people of India. The people of India developed enmity towards Muslims”
Bhimadeva of Anhilawada continued to rule large parts of Gujarat after the re-treat of Ghazni army. He reconstructed the temple at Somnath such that worship of Shiva could continue at the site. The death of Raja Bhoja in 1055 CE led to political instability in central India. Bhimadeva and Raja Karna of the Chedi dynasty attacked Malwa soon after the death of Raja Bhoja and ensured that Jayasimha, the successor of Bhoja at Ujjaini had to step down. After this, while parts of Gujarat were governed well, Malwa was neglected. The combined armies of Malwa under the leadership of commander Lakshmanadeva attacked Gujarat, which led to political instability in central India.
Bhimadeva's grandson Siddharaja (also famous as Jayasimha) became the king of Anhilawada in 1096 CE. He started to develop areas which had suffered due to conflict with Malwa. Siddharaja encouraged art, literature and other aspects of culture. It is during his time that Anhilawada became noted for cultural aspects. Even after 900 years since his rule, there are hundreds of folk songs in Gujarat that describe his achievements. Siddharaja won over Malwa and shifted the library of Raja Bhoja to Anhilawada. Siddharaja met Bhavabrhaspati at Ujjaini and requested him to come to Somnath and lead the revival of the Somnath temple. Bhavabrhaspati was a well-known scholar of the Pashupatha Sect. Somnath was restored as a center of learning, trade, and religious activities. During the reign of Siddharaja, Gujarat also made huge strides as a state. After the death of Siddharaja in 1144 CE, Kumarapala, most influential among subordinate rulers of Siddharaja, became the ruler since Siddharaja didn’t have any sons who could have become the natural choice for kingship. Kumarapala chose the Jain way of life due to the influence of the poet friend Hemachandra but continued to worship Somnath.
In 1164 CE, Bhavabrhaspathi requested Kumarapala to rebuild the Somnath temple. Bhavabrhaspati was given complete responsibility to supervise the rebuilding of the temple. Bhavabrhaspati not only rebuilt the temple but also secured the town by building a fort on the boundary of the town. He also built temples for Parvati (remains of this temple can be seen on the north-west corner of present day Somnath temple), Bhimeshvara and Siddheshvara. The temple complex of Somnath was expanded and a huge sabha mantapa, tank were also built. The shivalinga was about three times the height of a normal person. It is this temple structure which existed in a hopeless state when Sardar Patel initiated rebuilding of the temple in 1947.
In 1178 CE, Bhimadeva II of the Solanki dynasty ascended the throne in Anhilawada. During his reign Mohammed Ghori, attacked Gujarat but had to return with major losses. After winning the second battle of Tarain in 1192, he installed his commander Qutb-ud-din Aibak as the ruler of Delhi. In 1197, Aibak attacked Anhilawada and captured it. But this victory was short-lived; withing months, Bhimadeva won back the areas captured by Aibak and was given the title 'Abhinava Siddharaja' by the people.
During a visit to Somnath, Bhimadeva met Chauladevi, a dancer. Bhimadeva married Chauladevi and took her to Anhilawada. But Chauladevi was an ardent worshiper of Somnath and she didn't enjoy her days at Anhilawada. She was depressed that she couldn’t worship and dance in front of Somnath. Realizing this, Bhimdeva built a megha-mantapa at Somnath attached to the temple to please his wife. Legend says that Chauladevi left Anhilawada to Somnath and spent the rest of her life in worship of Somnath. Bhimadeva built many monuments which carry great architectural value. The stepped well called 'Rani ki Vav' in Anhilawada and the Sun Temple at Modhera were built during Bhimadeva’s reign.
After Bhimadeva’s death, commander Visaladeva united all the forces of Gurjara and became the ruler. He ruled from about 1247 to 1262. His son Arjunadeva ascended the throne in 1262 and ruled till 1274. The Veraval inscription of 1264 CE describes the rule of Arjunadeva. It also states that during this time Amir Rukunadin was ruling the Arab coast. Nora-din Feroz, a trader, with the blessings of the pashupatacharya of Somnath, built a small masjid on the outskirts of Somnath. Ironically, during the same time the Muslim rulers of North India were ransacking temples and building mosques over it. Arjunadeva started a school for higher education at Somnath called 'Sarasvat Sadas' and also built a sports complex called as 'Sarasvat Kridaketan.'
Rise of the Khiljis
In 1290, the Khilji dynasty came to power in Delhi. In 1292 CE, Ala-ud-din Khilji attacked town of Bhilsa (now called as Vidisha in MP) and looted the temples there. During this time Karnadeva was ruling over Gujarat. There is historical evidence to show that Madhava, the prime-minister of Karnadeva invited Ala-ud-din Khilji to Gujarat. This episode has been documented by Merutunga in his Prabanda Chintamani and Jinaprabha Suri in his work Tirthakalpataru. Madhava assumed charge of the Muslim army and attacked Anhilawada. Alaf Khan, the commander of Khilji occupied Anhilawada. They continued to loot other towns like Surat and Randhar and returned towards Somnath along the coast. Meanwhile, the Rajputs put up a brave fight to defend Somnath but the Khilji army captured the fort of Somnath. Khilji broke the linga into pieces and sent it to Delhi. Madhava was also killed by Alaf Khan since his utility was over. All through the way back to Delhi, Khilji's army indulged in forced conversions and took thousands as slaves to Delhi.
Khangara, the king of Junagadh, renovated the temple and re-installed the linga at Somnath c. 1351. Somnath continued to be ruled by kings from Delhi. In 1393, Zafar Khan, Thuglaq’s governor to Gujarat, destroyed the temple that had been renovated fifty years earlier. After the fall of Thuglaq dynasty, the governor of Gujarat became independent and called himself 'sultan.' Zafar Khan killed his son to become the 'sultan,' but was poisoned by his grandson Ahmed Shah. Ahmed Shah changed the capital from Anhilawada to Karnavati and named it as Ahmedabad. He captured the whole of Gujarat and brought it under Islamic rule. He also defeated the kingdom of Junagadh, which was the only Hindu kingdom left. In 1459, his thirteen-year-old grandson became the sultan with the name Mohammed Begada. In 1467, Begada defeated Mandalika of Junagadh but the latter continued to worship Somnath. Enraged by the continuing worship of Somnath, Begada attacked Junagadh and defeated Mandalika in 1469. Mandalika converted to Islam after his defeat. Begada threw away the linga at Somnath and converted it into a masjid. Most of the Islamic architecture into the structure was added during this period. Due to the constant threat looming at Somnath, the trade also went down and as did the glory of the town. Surat became the alternative coastal city for trade and commerce.
Resurgence of Somnath
In the early 16th century, the temple was raised by the people of Somnath so as to mask the tomb of the masjid. Regular worship of Somnath resumed after a gap of about 150 years. The political situation in Gujarat became unstable and in 1573, the Moghul emperor Akbar captured Gujarat and added it into his empire. The worship of Shiva continued even when Akbar’s rule extended to Somnath.
In 1675, Aurangezeb ordered Mohamed Azam, the governor of Gujarat, to damage the Somnath temple in order that it could not be renovated and used for Hindu worship. The Marathas exerted pressure on the Moghuls in late 17th and early 18th century. Aurangzeb destroyed the temple structure at Somnath in 1706. But Damji Gaikwad captured Somnath subsequently. The temple structure had become weak so the worship started in a small temple just outside the town. The Marathas continued to weaken the Moghul forces and finally captured whole of Gujarat in 1759.
In 1783, the Rani of Indore, Ahaliyabai Holkar visited Somnath. She was depressed at the state of the temple structure at Somnath. Since the temple was not fit to use, she built a temple just a few meters away, which stands to even this day. To avoid the chances of the linga being broken down, Ahilyabai installed the linga in a cellar on which the temple was built. In 1800, the whole of Saurashtra came under the Gaikwads of Baroda. The Gaikwad dynasty continued to worship Somnath. But in 1820, Jungadh fell into the hands of British and the Nawab of Junagadh pursued the British to levy tax on visitors to Somnath. The Gaikwads of Baroda protested this move and the British recalled the tax.
Sardar Patel vows to rebuild the Somnath temple
In 1947, after India secured independence from British, the Nawab of Junagadh wanted to accede to Pakistan. He announced that Junagadh will secede to Pakistan on 15 September 1947. But the 82% majority of non-Muslim population wanted to align with India. The Nawab started to intimidate people by violent methods. Eminent people of Junagadh state under the leadership of Shyamal Das Gandhi, Durlab Keshav Khaitani, Bhavani Shankar Ojha, Surag Bhai Varu, Manilal Doshi, and Narendra Nathwani formed a interim government, and declared that they will align with India.
Taking a cue from the situation, the Nawab escaped to Pakistan and asked his dewan, Shah Nawab Bhutto (the father of Zulfiqur Ali Bhutto) to look after the affairs of Junagadh. Realizing the the situation had grown out of hand, Bhutto wrote a letter to the commissioner of the Indian Government in Junagadh to make arrangements for India to take over Jungadh. On the day of Dipavali in 1947, Sardar Patel, Jam Saheb, and Kaka Saheb Gadgil went to Junagadh along with the army. The people of Junagadh welcomed the Indian Army and Junagadh was added into Indian State. On kartika shuddha padya, Sardar Patel visited Somnath and was moved by the state of the temple. He along with Jam Saheb, went to the sea shore, took the water of sea in his hand as the witness to his oath and promised that he would rebuild the Somnath temple.