The fortunes of Peshawar are inextricably linked to the Khyber Pass, the eastern end of which it guards. The pass seems to have been little used in prehistoric times, and even in early historic times, it was generally shunned as too narrow and thus too prone to ambush. Not until the powerful Kushans invaded Gandhara and pacified the area in the first century AD did the Khyber become a popular trade route. Since then, many emperors and rulers have ruled over this place and during this time, Peshawar has had as many names as its rulers. Moghul emperor Akbar formally gave the city the name Peshawar which means "The Place at the Frontier". Earlier it had been known as the "City of Flowers" and the "City of Grains".
Peshawar owes its founding 2,000 years ago to these same Kushans. In the second century AD, Kanishka, the greatest of the Kushan kings, moved his winter capital here from Pushkalavati, 30 kilometres (20 miles) to the north. His summer capital was north of Kabul at Kapisa, and the Kushans moved freely back and forth through the Khyber Pass between the two cities, from which they ruled their enormous and prosperous empire for the next 400 years.
After the Kushan era, Peshawar declined into an obscurity not broken until the 16th century, following the Moghul emperor Babur's decision to rebuild the fort here in 1530. Sher Shah Suri, his successor (or, rather, the usurper of his son's throne), turned Peshawar's renaissance into a boom when he ran his Delhi-to-Kabul sultanate through the Khyber Pass. The Moghuls turned Peshawar into a flowers city (one of the meanings of its name) by planting trees and gardens. In the 16th and 17th Centuries, the Moghul emperors filled Peshawar with garden mosques and monuments rivaling those in Delhi and Lahore. But the Moghuls were not able to keep control over much of the Pashtun territory beyond the Peshawar valley. Moghul emperor Aurangzeb lost the Peshawar valley to a Pashtoon Poet warrior Khushal Khan Khattak in the 1680s.
In 1818, Ranjit Singh captured Peshawar for his Sikh Empire. He burned a large part of the city and felled the trees shading its many gardens for firewood. The following 30 years of Sikh rule saw the destruction of Peshawar's own Shalimar Gardens and of Babur's magnificent fort, not to mention the dwindling of the city's population by almost half. Now, little remains of the glorious pieces of architecture and the beautiful gardens.