Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

BARA, Pakistan — The whitewashed mansion once housed a millionaire — but these days its marbled halls are home to a military experiment on returning former Taliban fighters to mainstream society.

The deradicalization center in war-torn Bara resembles a typical elite boarding school: there's a library, dormitory, canteen, recess and different sports teams. Its students are a select few — but weren't chosen for their academic strengths.

Former Taliban fighters attend a physics class. Wajahat S. Khan / NBC News

NBC News was granted access to one of the Pakistani military's three deradicalization centers in Bara — a critical component in the nation's war against terrorism. Pakistan's military has been accused by human-rights groups of abusing or even killing suspects in its custody.

At the Bara Center in Pakistan's unruly northwest nearly 400 former Taliban fighters spend 18-hour days under guard, supervised by military officers and instructed by specially-hired tutors. In addition to praying and studying Islamic history, they're learning skills like tailoring, welding furniture and repairing cell phones — plus shooting hoops and even jamming on the flute.

"We only release them when our psychologists say so"

As morning assembly ended with prayers for Pakistan and forgiveness, students in traditional white formal attire and black waistcoats walked single file to their classes without talking under the watchful eye of armored soldiers with weapons drawn.

These students are a rare breed: militants who've opted to lay down their arms and surrender, rather than fight or die in battle against the Pakistani military.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Classroom after classroom of former militants snap to attention military-style as Brigadier Muhammad Khalid comes to inspect their progress.

Khalid — the deputy inspector general of the Frontier Corps, which manages Khyber's three deradicalization centers — stressed the challenges of the process.

“It’s not easy," Khalid added. "These men didn’t go through conditioning at an internment center. They were fighting us one or two weeks before they were inducted here for deradicalization.”

The program is tightly scheduled and incorporates feedback from the students on what they would like to learn, Khalid said.

Former Taliban militants pray during morning assembly at a deradicalization center in Bara, Pakistan. Wajahat S. Khan / NBC News

"We split up their day according to adult literacy, vocational training, sports, drug rehabilitation and religious studies," he said. "And we only release them when our psychologists say so.”

Khalid said the military hopes for a trickle-down effect.

“From the individual, the hope is that this effort is going to deradicalize the family, then from the family to the community, then from the community to the society,” Khalid said.

Citing security concerns, Pakistan's military would not grant NBC News individual access to any of the students.

“They have a lot of enemies out there who are angry at them for abandoning their mission and becoming respectful civilians again,” Khalid explained. “The safety of their families is at stake if their identity is revealed.”

Students approached by NBC News without military supervision were apprehensive about talking: one 16-year-old disclosed he had belonged to the fierce Sipah-Afridi tribe that forms the backbone of the Lashkar-e-Islam militant group, while another student simply whispered that he wanted to be left alone and walked off, head bowed.

Pakistan-themed models of jets, boats and houses that were made by former Taliban fighters. Wajahat S. Khan / NBC News

The three centers processed 606 students over the last year at a cost of $3.93 million — a bargain, officers say, for rebuilding lives and decreasing future threats to the nation.

“When they graduate, we try to make sure they have a job waiting for them in the cities. Their community supervisors bring them in every few weeks to make sure they are not straying off," Khalid said. "We give them a stipend, too. Why? Because we are rebuilding a social fabric here destroyed by militancy, drugs and crime.”

The success of the programs is of critical importance to Pakistan's military, according to an intelligence official.

“We can’t afford a Guantanamo, or a Abu Ghraib," the official said, requesting anonymity. “These guys were conditioned to think we were foreigners, ‘kaafirs’ and ‘murtids’ [infidels and heathens]. So, we have to condition them back... The counterinsurgency in Pakistan has to conducted for Pakistanis, by Pakistanis.”