The region that is today known as Pakistan once had a large Buddhist population, with the majority of people in Gandhara (present day North Western Pakistan and Eastern Afghanistan) being Buddhist. Gandhara was largely Mahayana Buddhist, and was also a stronghold of Vajrayana Buddhism. The Swat Valley, known in antiquity as Uddiyana, was a kingdom tributary to Gandhara. There are many archaeological sites from the Buddhist era in Swat.
The Buddhist sage Padmasambhava is said to have been born in a village near the present day town of Chakdara in Lower Dir District, which was then a part of Uddiyana. Padmasambhava is known as Guru Rinpoche in Tibetan and it is he who introduced Vajrayana Buddhism in Tibet.
Buddhism was also practiced in the Punjab and Sindh regions.
Gandhara remained a largely Buddhist land until around 800 AD, when the Pashtun people invaded the region from Southern Afghanistan and introduced the Islamic religion.
Most Buddhists in Punjab converted to Hinduism from 600 AD onwards. Buddhism was the faith practiced by the majority of the population of Sindh up to the Arab conquest by the Umayyads in 710 AD. After the partition of Pakistan and India, the Buddhists fled to India, similar to other faiths like Hindus, Sikhs, and Christians in the Pakistan region.
The Kingdom of Gandhara lasted from the 6th century BCE to the 11th century. It attained its height from the 1st century to the 5th century under Buddhist Kushan Kings. After it was conquered by Mahmud of Ghazni in 1021 CE, the name Gandhara disappeared. During the Muslim period the region was administered from Lahore or from Kabul. During Mughal times the region was part of Kabul province. The Gandharas were settled since the Vedic times on the banks of Kabul River (river Kubha or Kabol) up to its mouth into Indus. The region is known as Peshawar Valley. Later the Gandharas crossed the Indus and included parts of north-west Punjab of Pakistan. Gandhara was located on the grand northern high road (Uttarapatha) and was a centre of international commercial activities. It was an important channel of communication with ancient Iran and Central Asia.