Defense Secretary Leon E. Panetta visits Asadullah Khalid, the head of Afghanistan’s intelligence agency who was wounded in Afghanistan Dec. 5 and arrived at Walter Reed National Military Medical Center for treatment. (Tolo News)

On Dec. 20, President Obama made another in a series of semi-regular trips to Walter Reed National Military Medical Center, where he met privately with 10 wounded U.S. service members — and a high-ranking Afghan government official who had recently been admitted.

Asadullah Khalid, the head of Afghanistan’s intelligence agency, suffered severe abdominal injuries in a suicide attack in Kabul on Dec. 5. According to the State Department, he had been granted entry to the United States in mid-December for medical treatment at the request of Afghan President Hamid Karzai’s administration.

The White House did not publicly announce that Obama had visited Khalid, but Afghan news outlets reported on the brief meeting. And a snapshot purportedly showing Obama standing by Khalid’s bedside — the spy chief wearing splints on his forearms and a bandage on his face — made the rounds on social media.

A leading U.S. human rights organization said it is outraged by the president’s decision to greet Khalid, who has been accused of abuses including torture and drug trafficking even as he distinguished himself as a Karzai ally and anti-Taliban figure in his native Kandahar.

“Even if your administration determined that humanitarian arguments justified his entry for medical treatment, a presidential visit to his bedside . . . was a major misstep,” Kenneth Roth, executive director of Human Rights Watch, wrote Dec. 23 in a letter to Obama, who is scheduled to meet with Karzai at the White House on Friday.

The president’s visit “created the impression that the United States is not concerned about his record of brutality and the abuse and corruption ordinary Afghans have suffered at his hands,” Roth wrote in the letter, a copy of which was obtained by The Washington Post.

Khalid’s standing as head of the National Directorate of Security illustrates the often conflicted nature of the U.S. military effort in Afghanistan, which relies on the intelligence and partnership of local officials who have tangled alliances and employ questionable tactics.

“Given the reasons we’re in Afghanistan and the primacy of the counterterror mission, obviously the head of the intelligence agency is going to play a very critical role” and is someone the United States would go to great lengths to help, said a senior administration official, who spoke on the condition of anonymity.

Khalid is a longtime U.S. ally who climbed the ranks of the Afghan government with ease, even as allegations mounted against him. He was governor of Ghazni and Kandahar provinces before becoming minister for border and tribal affairs and one of Karzai’s most trusted cabinet ministers.

White House national security spokesman Tommy Vietor said Obama thinks “it was appropriate” to check on Khalid’s condition. “Mr. Khalid and the team he oversees work closely with the United States to protect Afghan citizens and American civilians and military service members in Afghanistan,” he said.

Vietor noted that the White House confirmed that Obama had met with Khalid on the day of the president’s visit to Walter Reed when a Washington Post reporter asked about it.

Khalid also recently received a visit from Defense Secretary Leon E. Panetta, according to Afghan media, which published a photo of the two together at the hospital. Pentagon officials said Panetta visited on Friday.

There is precedent for foreign government officials — even those surrounded by controversy — to be allowed into the country for medical treatment. Early last year, Ali Abdullah Saleh, then the president of Yemen, was granted a medical visa, even as human rights officials denounced abuses during his rule.

State Department officials said Khalid was not granted a visa but rather admitted under the Department of Homeland Security’s “parole” process, which grants temporary stays for foreign nationals under emergency conditions.

Patrick Ventrell, a spokesman for the State Department, would not directly address the allegations against Khalid but said rights allegations are a regular topic of discussion with the Karzai government.

It is not clear when Khalid will leave the United States. Karzai was scheduled to visit him Tuesday afternoon.

Kevin Sieff in Kabul contributed to this report.