At dawn, around fifty men dressed in spotless white shalwar kameez, black jackets and brown woollen hats assemble for morning prayer.
In a dimly lit room, they line up according to the pattern of the prayer rugs, which determines the exact distance between each man.
After prayers, the men exercise, then sit down for breakfast. At twenty past eight, class begins. The group is lectured on Islam and business skills before it is divided into vocational training classes.
Soon the hum of sewing machines, the flicking of switches and the clatter of metal parts echo through the rooms and hallways of the building — a hoof-shaped complex perched on a wooded slope leading down into Pakistan's Swat Valley.
Formerly a hotel management school, the building is now home to the Mishal Deradicalisation and Emancipation Programme, an initiative by the Pakistani army to reintegrate former Taliban back into society. Over three months, captured Taliban are taught to reject the extremists' hardline interpretation of Islam and are given vocational skills to enable them to make a living once they are released.
Mishal is one of six deradicalisation centres in Pakistan, most of which are run by the military. With the men all dressed similarly and subject to a strict routine, there is more than a hint of cadet school to Mishal. But it is yielding results: almost 1,800 "beneficiaries" have completed the programme and have been successfully reintegrated into society, according to Colonel Farhan, the officer in charge.
The current batch will add to that number, the colonel believes.
One of the ex-Taliban in Mishal is Inam, a shy twenty-year-old with a short beard and a friendly smile. Inam was captured by the army almost four years ago in his native province of North Waziristan, a wild, lawless area on the border with Afghanistan. He used to work as a cook in a Taliban training camp, crossing in and out of Afghanistan on several occasions. After some jail time, the army selected him for the deradicalisation programme — a second chance Inam was grateful for.
Facing a wood panelled wall with electric metres, switches and plugs, Inam studiously unscrews a light switch. Other young men sit next to him, working in silence.
Before joining the Taliban, Inam was scraping a living selling fruit and vegetables. Poverty and a lack of prospects made him susceptible to the Taliban, who often dropped by his stall to persuade him to join them. Eventually, he did.
Man suspected of rape and murder of Zainab Ansari arrested in Pakistan
Trump administration prepares to withhold $255 million in aid to Pakistan
His family disowned him after he joined the Taliban. This is a common problem for the men at Mishal and the army is working to convince families to accept their errant sons. Inam is hoping to marry his fiancé when he gets out, and find work as an electrician.
"God willing, when I go out I will be doing this work. I will earn money for my family. Whatever I did is done. I accept my mistake. Now, I can concentrate on my family and my work," he said.
Not all former Taliban at Mishal will end up fixing faulty electric wiring upon their release. The programme offers a range of vocational courses: beekeeping, vulcanising, welding, sewing, weaving and even computer literacy.
Next door to the electricians' workshop, Asad, 23, is determined to master the use of an ancient desktop computer. Gingerly tapping commands into the keyboard, he feels that IT proficiency is essential to get ahead and he is keen to continue learning once he is out.
"All academic institutions use computers these days," said Asad.
The Pakistani army fought costly campaigns to expel the Taliban from the Swat Valley and Federally Administrated Tribal Areas (FATA). Known as the Tehrik-i-Taliban, or TTP, the insurgents had close ties to the Taliban in nearby Afghanistan and posed an increasing internal threat before the army swept into the border regions.
The only truly effective institution in Pakistan, the army has since begun to provide administration and reconstruction efforts in the war ravaged areas, only gradually handing over these responsibilities to the government. It has also taken the initiative in the deradicalisation efforts.
Only low-level militants, hand-picked by the army from the large number of Taliban languishing in jail, find themselves in one of the six deradicalisation sites. Captured informants, sympathisers providing shelter to the jihadists or helping out in Taliban camps are given a shot at freedom.
"None of them have blood on their hands," says Brigadier Avais, the commanding officer in the area, of the men at Mishal.
Because they are not hardened former fighters, recidivism among those released from Mishal is low, according to the army. Experts say that the military's deradicalisation drive is bearing fruit.
"They serve an important role in reducing their support level by allowing low and mid level cadres a second chance at life," says Zubair Azam, who works to combat extremism in Pakistan with non-profit Peace Education and Development Foundation.
But reintegrating non-violent Taliban will not suffice to eliminate the extremist threat in the border areas and wider Pakistan. A government riven by corruption has neglected to provide its people with jobs, education, and a functioning judicial system.
Asad, who was unemployed when he was taken prisoner for allegedly aiding the Taliban — a charge he denies — recalls one of the ways the extremists made themselves popular in the impoverished, traditional frontier regions.
"In the areas they controlled, the Taliban changed the dowry from three to four hundred thousand rupees (Dh10-13,000) to sixty thousand rupees only. It was things like these that influenced people at that time," he says.
To the many Pakistanis facing hardship, offering relief is an effective way of gaining support. While this lesson is being applied at Mishal, the government in Islamabad still has some way to go, Mr Azam believes.
"In order to prevent a resurgence of the TTP, it is important that the … genuine grievances of the locals with regards to governance, the economy and the justice system are addressed," he says.