ACHIN, Afghanistan -- His days begin as an office worker, but most afternoons he ends up leading troops on one of Afghanistan's most dangerous frontlines.
Haji Ghalib Mujahid, 58, is the civilian district governor in a remote region in the eastern Afghan province of Nangarhar. But the bearded figure spends most of his time fighting the Islamic State (IS). Locally known by its Arabic name Daesh, IS still control pockets of the mountainous Achin district, which border's Pakistan's tribal areas to the east.
Ghalib's day begins at 6 a.m., when he begins receiving petitioners, most of whom need his help to obtain Afghan identity papers or help in reopening schools and clinics. He also looks after thousands of displaced families in Achin.
But by 10 a.m. he picks up his Kalashnikov rifle and puts on his bulletproof vest. His SUV often leads the police and army convoys that chase militants in the distant mountain hamlets.
"We are making rapid advances and will not rest until finishing off Daesh," he said while taking a break after exchanging fire with IS fighters hiding in the Achin mountains. "My fight against them will continue until I avenge all our martyrs."
Locals and Afghan officials say IS swiftly overran Achin and seven more districts in Nangarhar this spring. Their atrocities forced thousands of families, most of them members of the Pashtun Shinwari tribe, to flee their homes and seek refuge in Nangarhar's capital, Jalalabad.
But things began to change when the Afghan government appointed Ghalib as the district governor of Achin. "When I arrived, they were on the cusp of running over Achin's district center, and one of my first tasks was to push them back," he said of the battle in late August.
"God sent Haji Ghalib to protect us from these oppressors," said Shan Bacha, a tribal leader in the district. Many of the nearly 100,000 Achin residents have experienced violence or oppression at the hands of IS. Even the Taliban condemned an IS video in early August that apparently showed IS militants blowing up bound and blindfolded Afghan prisoners. Most of the victims were shopkeepers and shepherds from Achin.
"I will not rest until I chase them out of Achin and [the neighboring] Deh Bala district. I will even chase them into Tirah [in Pakistan]," Ghalib said.
In an ironic twist, Ghalib is now fighting an old friend, Abdul Rahim Muslim Dost, who is one of the most senior leaders of IS Khorasan -- the Afghanistan-Pakistan branch of the ultra-radical group that now controls large parts of Iraq and Syria and is implicated in major terrorist attacks in the Middle East and Europe.
Ghalib, a former police officer, knew Dost from the days when they fought with the Islamist mujahidin guerillas against the Soviet occupation of Afghanistan in the 1980s. The two became close friends during Ghalib's four-year incarceration in a U.S. detention center in Guantanamo Bay, Cuba.
"Indeed, we were close friends when we were there [in Guantanamo]. But when we returned to Afghanistan, we parted ways," he said. "I once told Muslim Dost, 'Don't go to Pakistan because they will use you [against your own country]'."
Afghan officials accuse Pakistan of supporting insurgents. During the past two months, Ghalib has repeatedly accused Islamabad of being behind the IS offensive in Nangarhar. Pakistani officials have not commented on the accusations, but Islamabad often rejects claims that it supports Afghan rebels.
Ghalib, a native of Nangarhar's Ghani Khel district, was arrested by U.S. Special Forces in February 2003 and was later taken to the Guantanamo prison in July that year. He was released in late 2007, and his secret detainee assessment made public by the controversial whistleblower website WikiLeaks noted Ghalib was "not assessed as being a member of Al-Qaeda or the Taliban."
His return from Guantanamo didn't end his ordeal. He was soon in the Taliban crosshairs for supporting the government. He has lost 24 relatives to insurgent snipers and bomb attacks.
In August 2013, 18 members of his extended family were killed when a bomb planted in a Ghani Khel graveyard exploded. Most of the victims were women and children who were visiting the tomb of a relative during the Muslim holiday of Eid al-Fitr, when it is customary to visit the graves of relatives.
"When I hear our children crying, I am motivated to fight against the enemies of our homeland," he told an interviewer.
Abubakar Siddique wrote this story based on Shah Mahmood Shinwari's reporting from Achin, Afghanistan.