By Tim Lister and Aliza Kassim, CNN
Brigadier General Ali Khan was close to retiring at the end of a distinguished career in the Pakistani Army when he was detained early in May - and accused of links with an outlawed Islamist group.
His arrest, which became public Tuesday, shocked fellow officers at army headquarters and again raises the specter that senior ranks of the Pakistani officer corps may be infiltrated by Islamist militants.
Brigadier Khan is the most senior officer to face such allegations since 1995, according to a CNN analysis of previous cases.
Army spokesman Major General Athar Abbas said Khan was believed linked to Hizb ut-Tahrir (Party of Liberation). He said efforts were underway to arrest members of the group who had been in contact with Khan.
"The military has zero tolerance for any such activity and strict disciplinary action will be taken against those involved," said Major General Abbas.
Pakistani officials say Brigadier General Khan, who is 59, had an administrative role at army headquarters in Rawalpindi. His work did not involve counterterrorism and he did not command any unit. But he would have seen plenty of sensitive information.
Khan comes from a military family stretching back three generations, and has a son in the armed forces. Pakistani media report that one of his brothers is a colonel with the intelligence service.
Reuters news agency quoted Khan's wife as dismissing the allegations as "rubbish," saying her husband was "an intellectual, an honest, patriotic and ideological person."
"It's a fashion here that whosoever offers prayers and practices religion is dubbed as Taliban and militant," Reuters quoted her as saying.
One of his brothers, Bashir Khan, told the Pakistani television network Aaj that the brigadier had been in the army for 25 years – serving with UN peacekeepers in Bosnia and spending time in the United States. In 2008, Khan received the highest honor available to soldiers of his rank.
Khan's detention comes amid heightened concern about religious extremism within Pakistan's armed forces.
Hizb ut-Tahrir says it is committed to non-violence but has urged soldiers to rebel against the military hierarchy and its goal it to establish a global Islamic Caliphate.
Pakistani sources tell CNN that in the aftermath of the raid that killed Osama bin Laden in Abbottabad, it produced pamphlets urging soldiers to turn against their commanders.
The group was outlawed by General Pervez Musharraf in 2004 but a Pakistani court subsequently overturned the ban. It is also active in the United Kingdom, Malaysia and Indonesia.
Simon Valentine, a British researcher who has studied extremism in the Pakistani armed forces, said that while Hizb ut-Tahrir doesn't advocate violence "a cardinal element of its ideology and modus operandi is to infilitrate the armed forces and, once gaining sufficient support, cause a military coup."
"Despite claims of zero tolerance of HuT within the Army," he said, "militant Islam, including the HuT, has much support from the grass roots to the highest level within all branches of the armed forces."
Valentine, who has researched Hizb ut-Tahrir in depth, said its views enjoy widespread support throughout Pakistani society.
"Such militancy as seen in the HuT is fuelled by an increasing anti-Americanism which is rife throughout Pakistan," he told CNN.
Hassan Abbas, a scholar at Columbia University who has written extensively about Pakistani military intelligence, the ISI, told CNN he suspected there was more to the case than any alleged contacts with Hizb ul-Tahrir.
"Association with such a group would not be enough to hold him for six weeks," especially as Khan was weeks away from retirement, he said.
Abbas, author of "Pakistan's Drift into Extremism: Allah, the Army and America's War on Terror," said there is an alarming trend that includes Pakistani pilots refusing to bomb militant strongholds, and units surrendering to militant groups rather than fire on them.
Last month, Pakistani Taliban insurgents stormed the Naval Air Station in Karachi, apparently armed with inside information on its layout and security. They destroyed two U.S. supplied surveillance aircraft.
Days before he was abducted and murdered, Pakistani journalist Syed Shahzad described that attack as "the violent beginning of an internal ideological struggle between Islamist elements in the Pakistani armed forces and their secular and liberal top brass."
He went on to quote unnamed sources in the ISI, Pakistan's military intelligence service, as saying: "It was shown several months ago that the Pakistan navy is vulnerable to Islamists when a marine commando unit official was arrested.....Now, they (intelligence) realize how the organization (navy) is riddled and vulnerable to the influence of militant organizations."
Last year two serving officers - including a colonel – and two former officers were indicted in a court martial for allegedly planning a terrorist attack on the Shamsi airbase.
Shamsi - in Balochistan province - is a remote base reportedly used by the United States drone program. The four were alleged to have been in contact with Hizb ut-Tahrir. They have pled not guilty.
And in 2004, several lower-ranking air force personnel were convicted in connection with assassination attempts against Pakistan's leader at the time, General Pervez Musharraf.
One of them, Abdul Islam Siddiqui, was hanged but maintained he was innocent of involvement. Other soldiers said they had been tortured into implicating him.
Valentine, who is a regular visitor to Pakistan, said Khan's arrest may be "part of an attempt to bolster the army's reputation amid accusations that it is pro-militant," in the wake of the raid by U.S. special forces that killed bin Laden.
But Hassan Abbas believes the military had no desire for the Khan case to become public. "The military is in deep crisis in the aftermath of Abbottabad," he says. "They would have preferred to hush this up."