Pakistan's Peshawar was once known as "the city of flowers," surrounded by orchards of pear, quince and pomegranate trees. It was a trading city, situated at the gates of a key mountain valley connecting South and Central Asia.
But for the past four decades, it has borne the brunt of rising militancy in the region, fuelled by the conflicts in neighbouring Afghanistan and the geopolitical games of great powers.
On Tuesday, the city with a population of about 2 million was reeling after one of Pakistan's most devastating militant attacks in years.
A day earlier, a suicide bomber unleashed a blast in a mosque inside the city's main police compound, killing at least 100 people and wounding at least 225, mostly police.
Analysts say the carnage is the legacy of decades of flawed policies by Pakistan and the United States.
"What you sow, so shall you reap," said Abdullah Khan, a senior security analyst.
Peshawar was a peaceful place, he said, until the early 1980s when Pakistan's then-dictator Ziaul Haq decided to become part of Washington's cold war with Moscow, joining the fight against the 1979 Soviet invasion of neighbouring Afghanistan.
Peshawar — less than 30 kilometers (20 miles) from the Afghan border — became the center where the American CIA and Pakistani military helped train, arm and fund the Afghan mujahedeen fighting the Soviets.
The city was flooded by weapons and fighters, many of them hard-line Islamic militants, as well as with hundreds of thousands of Afghan refugees.
Arab militants were also drawn there by the fight against the Soviets, including the scion of a wealthy Saudi family, Osama bin Laden. It was in Peshawar that bin Laden founded al-Qaida in the late 1980s, joining forces with veteran Egyptian militant Ayman al-Zawahri.
The Soviets finally withdrew in defeat from Afghanistan in 1989. But the legacy of militancy and armed resistance that the US and Pakistan fuelled against them remained.
"After the Russian withdrawal from Afghanistan in 1980s, Americans abandoned mujahedeen, Americans even abandoned us, and since then we are paying a price for it," said Mahmood Shah, a former Pakistani army brigadier and a senior security analyst.
The mujahedeen plunged Afghanistan into civil war in a bloody fight for power. Meanwhile, in Peshawar and another Pakistani city, Quetta, the Afghan Taliban began to organise, with backing from the Pakistani government. Eventually, the Taliban took power in Afghanistan in the late 1990s, ruling until they were ousted by the 2001 American-led invasion following al-Qaida's 9/11 attacks in the US.
During the nearly 20-year US war against the Taliban insurgency in Afghanistan, militant groups blossomed in the tribal regions of Pakistan along the border and around Peshawar.
Like the Taliban, they found root among the ethnic Pashtuns who make up a majority in the region and in the city.
Some groups were encouraged by the Pakistani intelligence agencies. But others turned their guns against the government, angered by heavy security crackdowns and by frequent US airstrikes in the border region targeting al-Qaida and other militants.
Chief among the anti-government groups was the Pakistani Taliban, or Tahreek-e Taliban-Pakistani, or TTP. In the late 2000s and early 2010s, it waged a brutal campaign of violence around the country.
Peshawar was scene of one of the bloodiest TTP attacks in 2014, on an army-run public school that killed nearly 150 people, most of them schoolboys.
Peshawar's location has for centuries made it a key juncture between Central Asia and the Indian subcontinent.
One of the oldest cities in Asia, it stands at the entrance to the Khyber Pass, the main route between the two regions.
That was a source of its prosperity in trade and put it on the path of armies going both directions, from Moghul emperors to British imperialists.
A heavy military offensive largely put down the TTP for several years and the government and the militants eventually reached an uneasy truce. Peshawar came under heavy security control, with checkpoints dotting the main roads, and a heavy presence of police and paramilitary troops.
TTP attacks, however, have grown once more since the Afghan Taliban returned to power in Kabul in August 2021 amid the US and NATO withdrawal from that country.
The Pakistani Taliban are distinct from but allied to the Afghan group, and Pakistani officials regularly accuse the Afghan Taliban of giving the TTP free rein to operate from Afghan territory.
Ahead of Monday's suicide bombing, Peshawar had seen increasing small-scale attacks targeting police. In another spillover from Afghanistan's conflict, the regional affiliate of the Islamic State group attacked Peshawar's main Shiite mosque in March 2022, killing more than 60 people.
Shah, the former officer, warned that more TTP attacks could follow and said that Pakistan needs to engage the Afghan Taliban and pressure them to either evict the TTP or ensure it doesn't launch attacks from Afghan territory.
"If we are to have peace in Pakistan, we should talk to TTP from the position of strength with help from the Afghan Taliban," he said. "This is the best and viable solution to avoid more violence."