The act of uniting by natural affinity and attraction of the various tribes, castes and the inhabitants of the Punjab into a broader common "Punjabi" identity and Punjabi nationalism started grooming from the onset of the 18th century, when Sikh Empire with Secular Punjabi Rule was established by the Maharaja Ranjit Singh, Prior to that the sense and perception of a common "Punjabi" ethnocultural identity and community did not exist, even though the majority of the various communities of the Punjab had long shared linguistic, cultural and racial commonalities.
During the late 18th century, due to lacking in unity by the natural affinity of the various tribes, castes and the inhabitants of the Punjab into a broader common "Punjabi" identity, after the decline of the Mughal Empire, led the Punjab region into a lack of governance. In 1747, the Durrani Empire was established by the Ahmad Shah Abdali in Afghanistan, therefore, Punjab saw frequent invasions by the Ahmad Shah Abdali, The great Punjabi poet Baba Waris Shah said of the barbaric and brutal situation that; "Khada Peeta Lahy Da, Baqi Ahmad Shahy Da" ("We Have Nothing With Us Except What We Eat And Wear, All Other Things Are For Ahmad Shah").
Actually, from centuries, Punjab was under continuous attack by the foreign invaders. Before invasions of Ahmad Shah Abdali, the Mughals were the invaders of Punjab. Punjabi tribes, castes and the inhabitants of Punjab revolted against them, but in a personal capacity and without uniting by the natural affinity of Punjabi people.
However, Punjabi Sufi Saints were in a struggle to awaken the consciousness of the people of Punjab. Before Baba Waris Shah, Shah Hussain approved Dulla Bhatti’s revolt against Akbar as; Kahay Hussain Faqeer Sain Da - Takht Na Milday Mungay.
In the result of spiritual grooming and moral character building of Punjabi people by the Punjabi Saints and Punjabi poets like; Baba Farid - 12th-13th century, Damodar - 15th century, Guru Nanak Dev -15th - 16th century, Guru Angad - 16th century, Guru Amar Das - 15th - 16th century, Guru Ram Das - 16th century, Shah Hussain - 16th century, Guru Arjun Dev - 16th - 17th century, Bhai Gurdas - 16th - 17th century, Sultan Bahu - 16th-17th century, Guru Tegh Bahadur - 17th century, Guru Gobind Singh - 17th century, Saleh Muhammad Safoori - 17th century, Bulleh Shah - 17th-18th century, Waris Shah - 18th century and Frequent invasions by the foreign invaders, at last by the Ahmad Shah Abdali, stimulated the natural affinity of Punjabi people, taught the lesson to the various tribes, castes and the inhabitants of the Punjab and forced them to unite into a broader common "Punjabi" identity. Therefore, Punjabi nationalism started to initiate in the people of the land of five rivers to defend their land, to protect their wealth, to save their culture and retain their respect by ruling their land and governing the people of their nation by their own self.
In the late 18th century, during frequent invasions of the Durrani Empire, the Sikh Misls were in close combat with the Durrani Empire, but they began to gain territory and eventually the Bhangi Misl captured the Lahore. When Zaman Shah invaded Punjab again in 1799, Maharaja Ranjit Singh was able to make gains in the chaos. He defeated Zaman Shah in a battle between Lahore and Amritsar. The citizens of Lahore, encouraged by Sada Kaur, offered him the city and Maharaja Ranjit Singh was able to take control of it in a series of battles with the Bhangi Misl and their allies. Later Maharaja Ranjit Singh conquered the Kashmir valley, Ladakh, along with modern day Gilgit-Baltistan and Khyber Pakhtunkhwa and annexed it into greater Punjab region by establishing Sikh Empire with Secular Punjabi Rule which provided the boost to the already initiated Punjabi nationalism.
Traditionally, from the initiation of Punjabi nationalism, Punjabi identity is primarily linguistic, geographical and cultural. Punjabi identity is independent of race, color, creed or religion, and refers to those for whom the Punjabi language is the first language, those who reside in the Punjab region and associate themselves with the Punjabi Nation.
Integration and assimilation are important parts of Punjabi culture since Punjabi identity is not based on tribal connections, race, color, creed or religion. More or less all Punjabis share the same cultural background.
Historically, the Punjabi people were a heterogeneous group and were subdivided into a number of clans called Biradari (literally meaning "Brotherhood") or Tribes, with each person bound to a clan. However, Punjabi identity also included those who did not belong to any of the historical tribes of the Punjab. With the passage of time, tribal structures are coming to an end and are being replaced with more cohesion and holistic society. That is why community building and group cohesiveness on the new pillars of Punjabi society due to initiation of Punjabi nationalism is in a process.
From the initiation of Punjabi nationalism the number of people belongs to Muslim, Sikh and Christian Religion is increasing, but the Religious composition of population percentage in the census table of 1881–1941 census shows that Punjabi Hindus decreased their population.
The year 1881 Muslims 47.6 Hindus 43.8 Sikhs 8.2 Christians 0.1 Others 0.3
The year 1891 Muslims 47.8 Hindus 43.6 Sikhs 8.2 Christians 0.2 Others 0.2
The year 1901 Muslims 49.6 Hindus 41.3 Sikhs 8.6 Christians 0.3 Others 0.2
The year 1911 Muslims 51.1 Hindus 35.8 Sikhs 12.1 Christians 0.8 Others 0.2
The year 1921 Muslims 51.1 Hindus 35.1 Sikhs 12.4 Christians 1.3 Others 0.1
The year 1931 Muslims 52.4 Hindus 30.2 Sikhs 14.3 Christians 1.5 Others 1.6The year 1941 Muslims 53.2 Hindus 29.1 Sikhs 14.9 Christians 1.5 Others 1.3