Newly-graduated Afghan National Army soldiers march during their graduation ceremony at the in Kabul in January. The order that soldiers must either move their families to Afghanistan or leave the army could inflame ethnic tensions and aggravate relations with Pakistan. (Shah Marai/AFP/Getty Images)

In an effort to rid their army of Taliban infiltrators, Afghan officials have begun ordering soldiers with families in Pakistan to either move their relatives to Afghanistan or leave the military.

Afghan defense officials say the policy was crafted in response to a recent spate of incidents in which soldiers who were secretly working for the Taliban carried out attacks against NATO or Afghan troops. According to the army’s counterintelligence findings, those men often have ties to insurgent havens in Pakistan.

But the ultimatum could force painful choices for thousands of Afghan troops, and it is likely to stoke ethnic tensions just as the country’s leadership is seeking a negotiated end to the war. Purging members of the military with family in Pakistan also has the potential to aggravate long-troubled relations between Afghanistan and its eastern neighbor. Afghan President Hamid Karzai visited Islamabad on Thursday in a bid to enlist Pakistan’s help in winding down the conflict.

The policy has not yet received final approval from the Defense Ministry, and Afghan officials are still weighing whether to apply it nationwide, even as implementation begins in some areas. Mere consideration of the policy reflects the depth of anxiety in Afghanistan — both among Afghan officials and Western powers — over sleeper agents within the military.

U.S. officials have expressed concern about the Taliban’s ability to penetrate Afghan security forces but have not publicly proposed concrete remedies. Afghan commanders say that the connection between sleeper agents and time spent in Pakistan has been well documented and that there is consensus on the need to act.

“When they’re in Pakistan, they can be influenced and intimidated by the enemy,” said Lt. Gen. Sher Mohammad Karimi, the army chief of staff. “It’s a big concern, and it’s something we’re trying to change.”

Insurgent groups such as the Taliban are widely believed to operate from bases in Pakistan, and militants frequently travel back and forth across the border. Pakistan has denied long-standing allegations that it provides insurgents with support.

Afghan counterintelligence officials have already compiled lists of soldiers with ties to Pakistan. In some parts of the country, such as the battle-scarred south, soldiers on the list have been told: Move or leave the army.

“We’ve told them, ‘If you can’t move your families, you’ll be kicked out,’ ” said Col. Abdul Shokor, the top Afghan counterintelligence official in the Afghan army’s Kandahar-based 205th Corps.

On his desk, Shokor keeps a list of several hundred soldiers based in southern Afghanistan who visit Pakistan during their time off from the military. No deadline has yet been set for the families to move, he said.

If the new rule is implemented nationally, it could affect several thousand soldiers. Millions of Afghan refugees fled to Pakistan in recent decades to escape the fighting. About 1.7 million Afghans still live there, according to the Office of the U.N. High Commissioner for Refugees. Afghan soldiers often leave their families in Pakistan for security reasons.

The new policy would disproportionately affect Pashtuns, many of whom live in the border areas. The Taliban, which is predominantly Pashtun, has sought for years to argue that the Afghan government favors other ethnic groups, including Tajiks, Uzbeks and Hazaras. Hostility among ethnic groups has been a key driver of war in Afghanistan for the past three decades, and it has the potential to become even more of a factor as Western forces withdraw.

Pashtuns have historically been underrepresented in the Afghan army, but Pashtun soldiers now make up 40 percent of it — roughly equal to their share of the overall population and a hard-won improvement from several years ago.

A closer look at recruits

Training the Afghan army has been a top U.S. priority, and the force stands at 170,000 troops. But after years of rapid growth, defense officials say it’s time to take a closer look at the quality and allegiance of soldiers rather than focusing on recruitment numbers.

“As we approach our ceiling, we’re able to be more selective about our soldiers,” Karimi said.

He insisted that the policy would not be meant as an affront to Pakistan, but as a means of strengthening the Afghan army.

After an infiltrator’s attack last month on French troops north of Kabul, French President Nicolas Sarkozy announced that his country’s troops would depart a year earlier than expected. The assailant had probably had contact with the Taliban in Pakistan, French Defense Minister Gerard Longuet told reporters.

Shortly after the incident, the Afghan Defense Ministry sent top Afghan military officials a memo titled “Keeping the Enemy Out of the Army.” The memo highlighted the urgency of the infiltration problem and the need to make changes.

Attacks on foreign troops have inflamed tensions between Western trainers and Afghan recruits just as NATO’s commitment to Afghanistan appears to be waning. A report commissioned by the U.S. military said at least 58 Western military personnel were killed in 26 attacks by Afghan soldiers or police between May 2007 and May 2011, when the report was finished.“Such fratricide is fast leading to a crisis of trust between the two forces, if it hasn’t reached this point already,” the report concluded.

In Kandahar alone, four rogue Afghan soldiers have killed three American and two Australian soldiers in the past year. Shokor said that in each of those cases, “upon investigation, we found a relationship with Pakistan.”

Afghan officials are quick to point out that infiltrators don’t target only Western troops. Dozens of Afghan soldiers, police officers and top military officials have been killed by Taliban infiltrators in recent years, they say. Several months ago, Brig. Gen. Abdul Hamid, the top commander in southern Afghanistan, found an unexploded bomb under his desk. Last spring, a man in an Afghan army uniform opened fire inside the fortified Defense Ministry complex, intending to kill Defense Minister Abdul Rahim Wardak.

A senior Pentagon official played down the threat from Afghans with Pakistani relatives.

“Our strong sense is that the insider threat isn’t an organized effort. Insurgents are probably to blame in some cases, but sometimes it’s simply disaffected members of the ANSF [Afghan National Security Forces]. And it’s worth noting that instances of Afghan-on-Afghan violence inside the ANSF are more frequent than ANSF-on-NATO attacks,” said the official, speaking on the condition of anonymity.

The Afghan army has ramped up its counterintelligence operations over the past year. While its traditional vetting process required enlistees to get letters of endorsement from village elders and district governors, the army now pays increased attention to soldiers after they have been admitted into the armed forces, particularly when they are on leave and subject to Taliban threats. “We now have a special reconnaissance group to investigate what soldiers do on leave,” Hamid said.

Afghan officials have for years been weighing possible solutions to the problem of infiltration. Three years ago the country’s parliament issued a recommendation to the Defense Ministry to root out soldiers with ties to Pakistan, including those with families who own property there. The recommendation was not acted upon at the time, but it reflects the widespread sense among Afghan officials that Pakistan is at the root of their troubles.

“It’s all linked to Pakistan,” said Shukriya Barakzai, a member of the parliament’s defense subcommittee and its former chairwoman. “It’s crystal clear.”

Staff writer Karen DeYoung in Washington contributed to this report.