Sikh period in Lahore
The Sikh Rule in Lahore initiated from the invasion and rule of the Sikh Misls and extended till the Sikh Empire of Ranjit Singh (also known as Punjab, the Sikh Raj, and Sarkar Khālsā Rāj) which ended in 1849. The Sikhs began gaining power following the decline of the Mughal Empire in Punjab and consisted of a collection of autonomous Punjabi Misls, which were governed by Misldars, mainly in the Punjab region.
Rebellion against the Mughal Empire
Early in Aurangzeb's reign, various insurgent groups of Sikhs engaged Mughal troops in increasingly bloody battles. In 1670, the ninth Sikh Guru, Guru Tegh Bahadur encamped in Delhi, receiving large numbers of followers, was said to have attracted the wrath of Emperor Aurangzeb.
The execution of Guru Tegh Bahadur infuriated the Sikhs. In response, his son and successor, the tenth Guru of Sikhism Guru Gobind Singh further militarized his followers.
The Khalsa, or the Sikh Army, were the first in history to abolish the Muslim states and Mughal Empire in the whole province of Punjab in one stroke. The Singhs (Lions), led by Banda Singh Bahadur took over many Muslim and Mughal lands, establishing a Sikh Empire.
Other existing Muslim Emperors proclaimed a war against the Banda and the Khalsa. However many Muslim armies and their Emperors fled in dismay and despair after Wazir Khan's head was stuck up on a spear and lifted high up by a Sikh who took his seat at Sirhind, Muslim troops on beholding the head took alarm. Many Muslims embraced Sikhism and became Khalsa.
In a temporary alliance, both groups consisting of Hindu Rajas and Muslim Governors attacked Guru Gobind Singh and his followers. The united Mughal-Rajput Imperial alliance laid siege to the fort at Anandpur Sahib. In an attempt to dislodge the Sikhs, Aurangzeb vowed that the Guru and his Sikhs would be allowed to leave Anandpur safely. Aurangzeb is said to have validated this promise in writing. However Aurangzeb deliberately failed to keep his promise and when the remaining few Sikhs were leaving the fort under the cover of darkness, the Mughals were alerted and engaged them in battle once again; where two of the younger sons of Guru Gobind Singh, Zoravar Singh and Fateh Singh, were bricked up alive within a wall by Wazir Khan in Sirhind (Punjab). The other two elder sons - Ajit Singh and Jujhar Singh along with several Sikhs fought against the giant Mughal force achieving martyrdom. The Emperor died shortly after on March 3, 1707. Eventually the Guru was attacked and wounded by one of Aurangzeb's soldier, when he was sleeping, Jamshed Khan who was beheaded by the Guru, at the same time. The Guru would later die because the inflicted wounds.
The Three Chieftains of the Sikh Misls
At the time of the late 18th century, frequent invasions by Ahmad Shah Abdali and the Durrani Empire led to a lack of governance in the Punjab region. During thirty years following the final departure of Ahmed Shah Abdali, the Sikhs were left to themselves and increased in wealth and numbers. They gradually divided themselves into independent misls, under the command of hereditary chieftains, having a common place of meeting at Amritsar. Lahore, meanwhile, was portioned out amongst a triumvirate of Sikh chieftains, named, respectively, Gujjar Singh, Lehna Singh and Sobha Singh, who are spoken of to this day as the Three Hakims. The three chieftains split the city's revenue. For almost thirty long years Gujjar Singh along with Lehna Singh and Sobha Singh, ruled supreme and kept paying the Afghan invader and his offspring an annual sum to keep them at bay.
The Lahore Fort and the Walled City and its gates went to Lehna Singh. He was, for formal purposes, the governor of Lahore, and was so recognized. To Suba Singh went the area to the south of the Walled City, and he resided in the garden of Zubaida Begum in Nawankot, where he built a small fort for himself. The area between Amritsar and Lahore, or more correctly between the Shalamar Gardens and Lahore, went to Gujjar Singh. Gujjar Singh erected that part of the city, then a jungle and invited people to settle there. He also dug wells to supply water. A mosque was also built for the Muslims in the area. He also built himself a small fort called Qila Gujar Singh. Today, a few walls of that old fort can be seen in a street between today’s Nicholson Road and Empress Road, and the area is still called Qila Gujar Singh.
The three chieftains cooperated very closely with one another, and often they would have parties in which dancing women, or ‘nautch girls’ as the British liked to call them, entertained them. In these sessions, opium smoking was the norm. When asked why they used this drug, they laughed it off as a medicine recommended by hakeems. Thus they began to be called the three hakeems, a name that stuck to them.
On a final note, their rule ended when Ranjit Singh besieged the Lahore Fort in 1799 and the three chieftains fled from the city (in which at that time a number of Mughal-era monuments were altered or desecrated, while a few were entirely destroyed) and leaving it firmly in the hands of the young man from Gujranwala. 
Ranjit Singh's Empire
Ranjit Singh was crowned on 12 April 1801 (to coincide with Baisakhi) as the leader of a Sikh misl. Sahib Singh Bedi, a descendant of Guru Nanak Dev, conducted the coronation. The 1740s were years of chaos, and the city had nine different governors between 1745 and 1756. Invasions and chaos in local government allowed bands of warring Sikhs to gain control in some areas. In 1799, all Sikh Misls (warring bands) joined into one to form a sovereign Sikh state ruled by Maharaja Ranjit Singh from the royal capital, Lahore. During the 1740s, frequent invasions by Afghans led by Ahmad Shah Abdali and chaos in local government had made life very uncomfortable for the citizens of Lahore. Bhangi Misl was the fist Sikh band to plunder the Mughal Lahore. Later Ranjit Singh was able to make gains in this chaos. He defeated the son of Abdali, Zaman Shah in a battle between Lahore and Amritsar. Out of the chaos of Afghani and Sikh conflicts emerged a victorious Sikh by the name of Ranjit Singh who was able to unify the Sikh factions and capture Lahore where he was crowned Emperor. Ranjit Singh made Lahore his capital (shifting from the former capital, Gujranwala) in 1799 and was able to expand the kingdom to the Khyber Pass and also included Jammu and Kashmir, while keeping the British from expanding across the River Sutlej for more than 40 years. He rose to power in a very short period, from a leader of a single Sikh misl to finally becoming the Maharaja (Emperor) of Punjab.
For a brief half century, from 1799 to 1846, Lahore recovered under the patronage of Ranjit Singh and his successors. Ranjit Singh consolidated the Sikh misldaars (commanders) who had ruled more or less independently during the eighteenth century under a unified command and in 1799 he established Lahore as the administrative capital of a new Sikh kingdom. Nearby Amritsar became the spiritual and commercial center of the kingdom in 1802, after Ranjit Singh's troops occupied the city and the maharaja announced his intention to extend patronage and protection to the city's leading groups.
While much of Lahore's Mughal era fabric lay in ruins by the end of eighteenth century, rebuilding efforts under the Sikhs were shaped by and indebted to Mughal practice. Ranjit Singh moved into the Mughal palace in Lahore's citadel. By 1812 he had mostly refurbished the city's defenses by adding a second circuit of outer walls that followed the outline of Akbar's original walls and were separated from them by a moat. The maharaja also partially restored Shah Jahan's decaying gardens at Shalimar, and British maps of the area surrounding Lahore dating from the mid-nineteenth century show that walled private gardens - many of them bearing the names of prominent Sikh nobles - continued in the Mughal pattern under Sikh rule. The Sikh court continued to endow religious architecture in the city, including a number of Sikh gurdwaras, Hindu temples, and mosques. In short, the decaying structures and architecture of Lahore was restored by the emperor.
Arrival of the British Colonial Rule
The British occupation of Lahore took place in a protracted but concerted manner. Capitalizing on the disarray surrounding the succession struggles after Ranjit Singh's death and only partially diminished by a war fought against the Sikhs on their eastern frontier, the British rode into Lahore in February 1846 and garrisoned their troops in the citadel. Two unstable years later, they were drawn into a second war with the Sikhs at the southern city of Multan when that city's governor, Mul Raj, encouraged his troops to rebel. After a series of closely fought battles, the Sikh army was finally defeated in the Battle of Gujrat, sixty miles north of Lahore. In March 1948, following the British victory, Dalip Singh, Ranjit Singh's teenage son and heir to the throne, was formally deposed in Lahore. The remaining Sikh regiments in the city were abruptly decommissioned and camped outside the city demanding severance pay. Within a year, the Punjab was formally annexed to the British Empire and military sappers had begun leveling Lahore's city wall.
- Nalwa, V. (2009), Hari Singh Nalwa - Champion of Khalsaji, New Delhi: Manohar, p. 10, ISBN 81-7304-785-5.
- Grewal, J. S. (1990). "Chapter 6: The Sikh empire (1799–1849)". The Sikh empire (1799–1849). The New Cambridge History of India. The Sikhs of the Punjab. Cambridge University Press.
- Encyclopædia Britannica Eleventh Edition, (Edition: Volume V22, Date: 1910-1911), Page 892.
- The Ninth Master Guru Tegh Bahadur (1621-1675)
- J. S. Grewal (1998). The Sikhs of the Punjab. Cambridge University Press. p. 79. ISBN 0521637643.
- Sykes, Percy (2008)A History of Persia READ books. ISBN 9781443724081
- Cave-Browne 1861, p. 368
- Qila Gujar Singh - Who and Where?
- "Ranjit Singh, Maharaja", Sikh Cyber Museum