Almost two weeks ago, Afghan national police were forced to drop their ammunition and flee from the Zibak district of Badakhshan province in the far northeastern corner of Afghanistan as insurgency numbers swelled.

Despite being vastly outnumbered and outgunned, surviving soldiers established a new front line in the Ishkashim district of the province. With ceaseless heavy fighting over the past 13 days, they came dangerously close to losing the strategic peninsula of land between the Tajikistan and Pakistan borders, which connects Afghanistan to its vital trading partner, China.

Commanding Officer Col. Mohammad Nader, of the 5th Battalion, 7th Brigade of the Afghan Border Police, told Fox News this week that the strength of the insurgency – in an area that just a few years ago was considered a beacon of stability – forced his troops to push back, and again many had to drop their ammunition in a devastating retreat.

AFGHAN FORCES LOSING TO TALIBAN IN FIGHT FOR KUNDUZ

But on Thursday, Afghan officials claimed a much-needed victory. Not only have their troops gained critical ground closer to Zibak, but Ishkashim has been reclaimed from the clutches of the radical Islamist Taliban fighters.

So what made the difference between losing and regaining?

“We reorganized troops and brought in 600 elite Special Forces,” Nader explained. “Most importantly, many of these soldiers were from the region so they really knew the terrain.”

The support from civilians over the past few days also proved vital, Nader said, with fed-up villagers uniting to provide food and crucial information regarding terrorist routes and locations.

Government forces captured more than 20 mountain positions in the village of Sohkhdaka on Wednesday, pausing only in the midst of heavy fog. In the process, they killed more than 130 insurgents and destroyed three of the tanks they had previously captured.

MOAB DAMAGE IN AFGHANISTAN EXTREME, WIDESPREAD

“This is also a moral victory,” Nader said. “This time, the terrorists lost their will to fight.”

Afghan government forces were also able to seize some of their weapons back from the enemy – 82mm recoilless rifles, mortar rounds, DShK “dishka” machine guns and ammunition. Nader noted that his battalion did receive some NATO air support but emphasized the need for more strikes if they are to hold onto the retaken land and continue repelling the Taliban from the area.

Yet perhaps even more fundamental to their continued success is the need to stop the flow of reinforcement terrorists coming in directly from the Chitral area in northern Pakistan.

“It’s encouraging that the Afghans have the ability to mobilize quickly to respond to threats. Their efforts to reinforce Ishkashim and subsequent move to retake Zibak were critical as Afghanistan could have lost its connection to the entire Badakhshan peninsula,” Lt. Col. (Ret) Jim Reese, a Delta Force veteran and founder of TigerSwan told Fox News. “Now they must coordinate with the increasing U.S. presence to secure the border and disrupt the flow of terrorists on that key roadway into Afghanistan.”

INSIDE AFGHANISTAN: ARE MORE US TROOPS WHAT AFGHANS WANT?

As it stands, the Taliban and other armed militias control Zibak, Warduj, Yamgan districts as well as 10 other districts in Badakhshan. The province’s governor, Ahmad Faisal Begzad, has vowed that the operation will continue until the terrorists have been completely annihilated from the area.

On a larger scale, the Taliban occupies at least 40 percent of Afghanistan, which has prompted the United States to consider sending up to 5,000 more troops to take up advisory and training roles in support of the Afghan government.

Testifying before Congress in February, Army Gen. John W. Nicholson Jr., the leading American commander in Afghanistan, also raised the Pakistan issue.

“It is very difficult to succeed on the battlefield,” he said, “when your enemy enjoys external support and safe haven.”

Hollie McKay has been a FoxNews.com staff reporter since 2007. She has reported extensively from the Middle East on the rise and fall of terrorist groups such as ISIS in Iraq. Follow her on twitter at @holliesmckay