Image copyright Getty Images Image caption For more than a decade Pakistan has kept Waziristan under tightly regulated travel restrictions

Tens of thousands of people have been killed in Pakistan's long battle with militants as part of the post-9/11 "war on terror". Evidence of murder and torture by soldiers and insurgents is emerging only now. The BBC has gained rare access to some of the victims.

It was early in 2014 when TV news networks trumpeted a major victory in the war against the Pakistani Taliban - the killing of one of the group's most senior commanders in a night-time air raid.

Adnan Rasheed and up to five members of his family were reported to have died in the strikes in the North Waziristan tribal area, near the Afghan border.

Rasheed, a former Pakistan Air Force technician, was well-known. He had written an extraordinary letter to Malala Yousafzai, the schoolgirl and activist shot in the head by Taliban gunmen in 2012, attempting to justify why it had happened. He'd also been in prison for trying to assassinate former President Pervez Musharraf - until he broke out.

Now it appeared that his luck had run out.

Quoting security officials, news channels reported on 22 January 2014 that Adnan Rasheed's hideout had been targeted two nights earlier in the Hamzoni area.

Waziristan and other parts of the vast mountainous tribal region have been controlled and locked-down by the Pakistani military since the US invasion of Afghanistan after 9/11, which saw Taliban fighters, al-Qaeda jihadists and other militants flee over the porous border.

Outsiders, including journalists, cannot get in - so verifying claims from the security forces is extremely difficult. Those who have reported stories from Waziristan that don't reflect well on the military have found themselves punished.

It turned out a year later that the jets had hit the wrong target - Rasheed confirmed this when he emerged in a video to prove he was alive.

Image caption Adnan Rasheed had been sentenced to death for trying to kill former president Pervez Musharraf

Instead of taking out a top militant, Pakistan's military had actually killed the family of a local man who had his home blown to pieces.

The authorities have never acknowledged they made a mistake. The BBC travelled to Dera Ismail Khan, a town on the banks of the river Indus that is the gateway to the remote and forbidding tribal areas, to meet the man whose house was hit.

"It must have been 11pm or thereabouts," recalls Nazirullah, who was 20 at the time. He and his wife had recently married and had the rare privilege of a room to themselves. The rest of their large family slept in the only other room in their house in Khatei Kalay village.

"It was as if the house had exploded. My wife and I were shaken out of our sleep. There was a strong smell of gunpowder in the air. Both of us rushed to the door and stepped out, only to discover that the entire roof of our room had already collapsed, except a corner where our bed was."

Image caption Nazirullah and his niece Sumayya survived but four members of the family were killed

The roof of the second room had also collapsed, and a fire was raging across the compound. Nazirullah heard cries from the rubble and, with his wife, frantically tried to help those they could see in the glow of the fire.

Neighbours helped them dig out the injured and the dead.

Four of Nazirullah's family died, including a three-year-old girl. His niece Sumayya, whose mother was among those killed, was then just a year old, and survived with a fractured hip. Another four members of the family were rescued from the rubble. All suffered fractures and other injuries.

Nazirullah's family has since moved back to Dera Ismail Khan, where life is more peaceful.

Like many others in this part of Pakistan, they have had to move several times to escape an insurgency that has been raging in the tribal areas for nearly two decades.

According to authorities and independent research groups, militant violence since 2002 has forced more than five million people in Pakistan's north-west to leave their homes to seek refuge either in government-run refugee camps or rented houses in peaceful areas.

There are no official figures of the total death toll of this war but estimates from academics, local authorities and activists put the number of civilians, militants and security forces killed at well over 50,000.

Local rights activists say scores of civilians have been killed in successive air campaigns and ground operations by the military. They have been collecting video and documentary evidence to back up their claims.

These activists are linked to a prominent new rights campaign called the Pashtun Tahaffuz (Protection) Movement (PTM) which emerged early last year and has since been publicising alleged rights abuses in the tribal region that victims had previously been too scared to report.

"It has taken us almost 15 years of suffering and humiliation to gather courage to speak up, and to spread awareness about how the military trampled our constitutional rights through both direct action and a policy of support for the militants," said Manzoor Pashteen, the top leader of the PTM.

But the group is under pressure. The PTM says 13 of its activists were killed on 26 May when the army opened fire on a large group of protesters in North Waziristan. The army said at least three activists were shot dead after a military checkpoint was attacked. The PTM denies this but two of its leaders, who also serve as MPs, have been arrested.

Image copyright Aamir Qureshi/Getty Images Image caption Pashtun Protection Movement leader Manzoor Pashteen has helped publicise rights abuses

A number of cases highlighted by the PTM - and which the BBC investigated independently - were shared with a Pakistani military spokesman but he declined to respond, calling such allegations "highly judgmental".

There was no response to BBC requests for comment from the government of Prime Minister Imran Khan, even though Mr Khan raised the issue of rights abuses in the tribal areas when he was an opposition politician.

How 9/11 put the Taliban into Pakistan

It all started with the al-Qaeda attacks in September 2001 in New York and Washington.

When the US attacked Afghanistan in October 2001, the Taliban forces that had sheltered al-Qaeda leader Osama Bin Laden melted away without a fight.

Image copyright Getty Images Image caption Armed Pakistani Taliban at a hideout in the tribal district of Orakzai in 2009

Pakistan, which was one of only three countries to have recognised the Taliban when they seized power in Kabul in 1996, had an interest in keeping the movement alive as part of its efforts to prevent Indian influence from spreading in Afghanistan.

So while Pakistan had been dependent on US military aid for decades and the then military regime of Gen Pervez Musharraf had joined the US "war on terror", it also allowed the Taliban to carve out sanctuaries in Pakistan's semi-autonomous tribal areas, notably the districts of North and South Waziristan.

But the Afghan Taliban did not cross the border alone. Militants from a complex array of different groups poured into the tribal region and some were far more hostile to the Pakistani state.

Jihadists with global ambitions also began plotting attacks from Waziristan, prompting demands from Washington that Pakistan do more to crush Islamist militancy.

As violence spread, Pakistan was caught "between an inclination to fight militant forces and yet having to partner with some to strengthen its future bargaining position", said Ayesha Siddiqa, a security analyst and author of the book Military Inc: Inside Pakistan's Military Economy.

In 2014, Pakistan launched a new operation in North Waziristan that increased pressure on militant groups and their safe havens and was credited with reducing attacks elsewhere in the country.

'The Taliban and the military are doing the same thing'

When the Taliban arrived in the tribal areas in 2001, they were given a cautious welcome by the local people. But this quickly turned into disillusionment when they started to take over tribal society by enforcing their strict religious codes.

During the first phase of that relationship, local youths joined the militants' ranks in their hundreds, thereby causing tribal rivalries to seep into the militant network. This was reflected in subsequent factional wars.

In the second stage, the Taliban embarked on a campaign to eliminate officially recognised tribal elders who were a hurdle in the way of the insurgents' drive to subjugate the tribes. At least 1,000 tribal elders have been killed by militants since 2002 and some estimates from non-governmental organisations put the figure at nearly 2,000.

Image copyright Getty Images Image caption Waziristan is rugged, inhospitable terrain - and closed to outsiders and journalists

One such assassination in North Waziristan in July 2007 is emblematic of how militants were able to subjugate the tribes.

"When they kidnapped and killed my brother, the tribe in our region was still strong, but because the military allowed [the militants] the freedom to move against our people, it broke our back," says Mohammad Amin, a Wazir tribesman from Razmak area of North Waziristan.

His brother's body was found dumped in an abandoned truck the day after he was kidnapped by militants. Mohammad Amin and other tribesmen were able to trace the attackers and confronted them. The ensuing gunfight left Mr Amin's son, Asadullah, a cousin and all four Taliban fighters dead.

Image caption Asadullah was shot dead by Taliban fighters trying to subdue his tribe

The tribe's subsequent calls on military officials in the garrison town of Razmak to curb Taliban violence were frustrated when militant leaders based in that very town threatened reprisal.

A decade on, Mr Amin is in no doubt that "despite occasional clashes with each other, the Taliban and the military are doing the same thing".

PTM activists have also documented several cases in which the security forces appear to have treated the local population brutally.

In May 2016, for example, an attack on a military post in the Teti Madakhel area of North Waziristan triggered a manhunt by troops who rounded up the entire population of a village.

An eyewitness who watched the operation from a wheat field nearby and whose brother was among those detained told the BBC that the soldiers beat everyone with batons and threw mud in children's mouths when they cried.

A pregnant woman was one of two people who died during torture, her son said in video testimony. At least one man remains missing.

Image caption Many tribal residents ended up in camps for displaced people in Peshawar and other places

The stories of survivors are painful too. I met Satarjan Mahsud in the town of Ramak, 100km (60 miles) further south down the Indus river from Dera Ismail Khan.

We sat inside a white tent and he told me his story over tea, with two young children at his side

One evening in April 2015 militants fired at a military post in Shaktoi, South Waziristan. Satarjan says troops responded by capturing suspects from a nearby village and shooting two of them dead.

Early the next morning, on 21 April, they extended their search across the valley to Satarjan's village where they found weapons stashed on a hill behind his house.

"The only people present in the house at that time were my brother Idarjan, his wife and two daughters-in-law," Satarjan says.

Image caption Satarjan has spent four years trying to trace his brother and nephews - to no avail

The soldiers knocked at the door. His brother answered and was immediately overpowered, tied up and blindfolded. The troops asked where other male members of the family were and rounded up Idarjan's four sons from elsewhere in the valley.

Witnesses later told Satarjan that the boys had been beaten, and his eldest nephew, Rezwarjan, received a lethal blow to the head.

All of them were thrown in the back of a pick-up truck which the soldiers had commandeered, and driven away to the army camp in the area.

The driver of the truck later told Satarjan that Rezwarjan was "already half dead and couldn't hold himself in a sitting position, so the soldiers decided not to take him to the camp".

He told Satarjan: "They asked me to stop the truck, shot Rezwarjan in the head and threw his body on the road."

Satarjan was working at a factory in Dubai at the time. He heard about what had happened and began the journey home. He took a flight, a bus and then walked for 15 hours to reach the village where Rezwarjan's body was found on 23 April.

Image caption People in the tribal areas have protested - but they are still waiting for justice

Locals there told him they hadn't been able to take the body across the valley to his family home because of a curfew, so they had buried it there on the hill.

He then walked across to his own village where he found his house deserted. The wives of Satarjan's brother and nephews had been taken in by relatives.

Satarjan knew the women wouldn't know the whole story because the curfew forbade travel between villages and there was no mobile network in the area.

When he met his sister-in-law, she told him what she knew: that her husband had been taken away by the army and that the younger men were missing.

"I was in two minds about whether to tell her. But then I thought it would be easier to give her the bad news about Rezwarjan once my brother and the boys had returned. I knew the army had nothing against them and would let them go soon."

So he made up a story, telling her that when the army raided their house, the boys got away to safety in Karachi, far away in southern Pakistan. He assured her that her husband would soon be released.

On 26 April 2015, he moved the family to Ramak. Since then he's had no word from the military on the fate of his brother and three nephews. Weeks have turned into months, and months into years.

He is not alone. Local activists say more than 8,000 people picked up by the army since 2002 remain unaccounted for.

Meanwhile, Satarjan has been dodging questions from the women about why they can't visit their village.

"I tell them our house in Shaktoi has been demolished by the army, which is partly true. But the real reason is that if they go there, neighbours will come for condolences and they will find out."

He says it would be better if he knew his brother and nephews had been jailed, or even killed. But not knowing anything is agony.

"I can't tell my sister-in-law her sons are missing, or dead. I can't tell the two young wives that they have been widowed," he says.

More from Ilyas in Pakistan

These individual stories are shocking but they are not unique. The PTM alleges that hundreds of people from the tribal areas could tell similar stories.

But they remain officially unacknowledged.

They are the consequences of a war Pakistan has gone to great lengths to hide from the world. This conflict on the Afghan border has for years been an information black hole.

And when the PTM broke through this chokehold last year, its media coverage was put under a comprehensive ban. Those in the media who have not heeded the ban have faced physical threats and financial pressure.

The military has openly called the PTM's patriotic credentials into question, accusing it of links to "hostile" intelligence agencies in Afghanistan and India.

And some PTM activists who were documenting cases of abuse and running the group's social media campaign have been jailed.

The treatment of the activists who are finally, after years of silence, raising the alarm on the abuses of a long and secret war suggests that those who have suffered in the conflict face an uphill battle for justice.