GULIBAGH, Pakistan Hazrat Gul spent two years in detention for allegedly aiding the Pakistani Taliban when they publicly flogged and beheaded people during a reign of terror in the scenic Swat Valley.
Now he wiles away his time in pristine classrooms, a Pakistani flag pin on his crisp uniform, learning about word processing, carpentry and car repairs at the Mashal de-radicalisation centre run by the army.
Part of a carrot and stick approach to battling militancy in the strategic U.S. ally, the aim is to cleanse minds of extremist thoughts through vocational training, and turn men like Gul into productive citizens who support the state.
The success of the programme will ultimately hinge, however, on the the ability of the government, widely seen as incompetent and corrupt, to help the de-radicalisation graduates find jobs.
"If a sincere leadership comes to this country, that will solve the problems," said Gul, 42, one of the Mashal students. "Today the leadership is not sincere. The same problems will be there."
Pakistan's military drove militants out of Swat in 2009. Mashal is in the building which used to be the headquarters of the militants from where they imposed there austere version of Islam.
Eventually, the army realised it couldn't secure long-term peace with bullets alone.
So military officers, trainers, moderate clerics and psychologists were chosen to run three-month courses designed to erase "radical thoughts" of those accused of aiding the Taliban.
Students like Mohammad Inam, 28, a former assistant engineer, give the school a good report card.
"The environment is very good. Our teachers work very hard with us. They talk to us about peace, about terrorism and how that is not right," said Inam, in the presence of a military officer. "God willing, we will go out and serve our country and our nation."
School officials say about 1,000 people have graduated since the initiative began two years ago, and that only 10 percent were not cleared for release.
Officials concede that their "students" are not hardened militants who killed. Mostly, they provided the Taliban with water, food or shelter, or beat people.
That was enough for a two-year detention, and some say abuse, in a country where the Taliban stage suicide bombings at will and have launched brazen attacks, including one on the army headquarters near the capital.
Even if the Mashal institute instills a new mindset and discipline in the students, graduates face an uncertain future.
The South Asian nation always seems to be on the verge of collapse and is often described as a failed state unable to cope with power cuts, widespread poverty and violence.
"The problem is the deprivation being faced by these individuals. There is no electricity. There are price hikes. There is no law and order or justice which prevails in the country," said Major Khurram Bajwa, one of Mashal's directors.
He pointed out how easy it is for the Taliban to recruit people. "It takes about two years to train an army officer, and one month to train a suicide bomber."
ISLAMIST LEADER HELPING
Pakistan joined the U.S. global war on militancy after the September 11, 2001, attacks on the United States, but critics accuse Islamabad of actually fostering the security nightmare in the Pakistan-Afghanistan border region by supporting militant groups it values as strategic assets. Pakistan denies the allegations.
The confusion was highlighted this month, when the United States put a $10 million bounty on an Islamist leader who Pakistani officials say has in fact been helping them turn militants away from a life as radicals.
Hafiz Saeed, suspected of masterminding an attack by Pakistan-based gunmen on India's financial capital, Mumbai, in 2008 that killed 166 people, met government officials and pledged his support for the de-radicalisation drive, the officials said. Saeed's organisation denied this.
Pakistan's military presents the Swat offensive and the campaign to root out extremism as a showcase of its success against militancy.
On the surface, the valley looks far more stable than it did in the Taliban days when Fazlullah, known as FM Mullah for his fiery radio sermons, was ordering his men to take to the streets and punish the "immoral", or anyone who disagreed with his violent philosophy.
Residents of Swat, 160 km (100 miles) from Islamabad, crowd street markets. Girls schools that were blown up by the Taliban have reopened. A ski resort burned down by the Taliban has re-opened.
That is due in large part to a sense of security created by the thousands of Pakistani soldiers still stationed there.
But the army's successes have been tarnished by allegations of human rights abuses.
Human Rights Watch says it has received credible reports of extrajudicial killings allegedly committed by soldiers or police in Swat. The army counters that it takes human rights seriously and has launched an investigation into the matter.
Sitting beside an officer in a classroom at the Mashal school, Gul said he was subjected to torture at prisons run by the military or its intelligence agency merely because, out of fear, he had chanted pro-Taliban slogans.
"Every time they were talking to us, (they were) beating us," said Gul, who has a masters in political science. Asked to elaborate, he said: "From A to Z, all kinds of problems."
Minutes later, the officer, who sleeps in a room with a commanding view he said was once occupied by Fazlullah, leaned over to this reporter and said: "What do you expect in prison, massage girls?".
The accounts of ill treatment were echoed by others.
Rehman Shah, a former school teacher, says he was only detained because his son was accused of joining the Taliban.
Nine weeks into the course, he praises the de-radicalisation concept but says the army made a big mistake by detaining innocent people.
"When Pashtuns are treated unfairly, it never leaves their hearts and they take revenge," Shah said of the dominant ethnic group in Swat and other parts of northwest Pakistan, where most of the military offensives against militants are mounted.
"I urge the government and security not to do this and not increase resentment and anger in the people."
A senior Pakistani intelligence official denied abuses take place.
"That's not our strategy at all. They are our own people and we do not believe in these things," he said.
LIFE OUTSIDE THE SCHOOL
Outside Mashal's classroom, there are signs that not everyone is embracing the new approach.
Soldiers led a hooded man into a truck while three others looked on through the barred windows of what appeared to be a cell at the compound.
Conditions still seem ripe for Fazlulah and his lieutenants, who have vowed to make a comeback, to recruit people.
Pakistani officials estimated after the army operation expelled the Taliban that over $1 billion would be needed to revive the local economy and rebuild infrastructure.
Residents like Ajab Noor, 61, who sent two of his sons abroad to work, doubt the population of about 1.3 million will ever benefit from those funds.
"People have no options. They either go outside the country to work, or they join militants who promise them many things," he said at a street market in Swat's capital, Mingora.
A member of a state-backed anti-Taliban militia believes two boys in his village had graduated from a de-radicalisation centre and ran away to rejoin the Taliban.
"I told the military, 'you are nurturing the offspring of snakes'. But they did not listen," he said.
(Additional reporting by Jibran Ahmad, Editing by Jonathan Thatcher)