The Muslims entered Sind, India, in 711 C.E., the same year they entered Spain. Their entry in India was prompted by an attempt to free the civilian Muslim hostages whose ship was taken by sea pirates in the territory of Raja Dahir, King of Sind. After diplomatic attempts failed, Hajjaj bin Yusuf, the Umayyad governor in Baghdad, dispatched a 17-year-old commander by the name Muhammad bin Qasim with a small army. Muhammad bin Qasim defeated Raja Dahir at what is now Hyderabad in Pakistan. In pursuing the remnant of Dahir's army and his son's supporters (Indian kings), Muhammad bin Qasim fought at Nirun, Rawar, Bahrore, Brahmanabad, Aror, Dipalpur and Multan. By 713 C.E., he established his control in Sind and parts of Punjab up to the borders of Kashmir. A major part of what is now Pakistan came under Muslim control in 713 C.E. and remained so throughout the centuries until some years after the fall of the Mughal Empire in 1857.
Muhammad bin Qasim's treatment of the Indian population was so just that when he was called back to Baghdad the civilians were greatly disheartened and gave him farewell in tears. There was a Muslim community in Malabar, southwest India as early as 618 C.E. as a result of King Chakrawati Farmas accepting Islam at the hands of Prophet Muhammad (pbuh). The Muslim presence as rulers in India dates from 711 C.E. Since then, different Muslim rulers (Turks of Central Asia, Afghans, and the descendants of the Mongol - the Mughals) entered India, primarily fought their fellow Muslim rulers, and established their rule under various dynastic names. By the eleventh century, the Muslims had established their capital at Delhi, which remained the principal seat of power until the last ruler of Mughal Dynasty, Bahadur Shah Zafar, was deposed in 1857 by the British. A few British visitors were given permission by Akbar to stay in Eastern India more than two centuries before. The British abused that privilege, and within a few decades the British began to collaborate with Rajas and Nawabs in military expeditions against the Mughals and Muslim rulers of the east, southeast and south India. After two centuries of fighting, the British succeeded in abolishing the Mughal rule in 1857.
Muslims were a minority when they ruled major parts of India for nearly a thousand years. They were well liked generally as rulers for their justice, social and cultural values, respect for freedom to practice religion as prescribed by the religion of various communities, freedom of speech, legal system in accordance with the dictates and established norms of each religious community, public works and for establishing educational institutions. In their days as rulers, the Muslims constituted about twenty percent of India's population. Today, Indian Muslims constitute about fifteen percent of India's population, about 150 million, and they are the second largest Muslim community in the world.
The region now part of Pakistan and many other parts of India were predominantly Muslim. After the British takeover in 1857, many of these areas remained under loose control of Muslims. When the British decided to withdraw from India without a clear direction for the future of Muslims (former rulers), a political solution was reached for some of the Muslim majority areas. This resulted in the division of India and the creation of Pakistan in 1947.
Among the famous Muslims scientists, historians and travelers who visited and lived, though briefly, in India were Al-Biruni, Al-Masu'di, and Ibn Battuta. Their writings illuminate us with the Indian society and culture. Al-Biruni stayed in India for twenty years. Ibn Battuta, an Andalusian who was born in Morocco, served as a Magistrate of Delhi (1334-1341) during the reign of Sultan Muhammad Tughluk. It is conceivable that Ibn Battuta's description of Muslim India inspired Ferdinand and Isabella who had taken over the last Muslim kingdom of Granada, Spain in 1492. That same year Columbus received the permission in the Alhambra palace (of Granada) and made his famous voyage bound for India in search of gold and spice but he landed in the Americas