WASHINGTON - While reaffirming that it recognises the Durand Line as a permanent border between Pakistan and Afghanistan, the United States has urged Islamabad and Kabul to work together to eliminate safe havens in the border region being used by terrorists to target innocent civilians in both countries.

"I’m not going to get into a topographical discussion with you today," State Department Spokesman John Kirby said when a journalist drew his attention to a statement by a former US diplomat Zalmay Khalilzad, who is of Afghan origin, that the Durand Line is a "disputed" border.

"I’m not going to redraw the map today between Afghanistan and Pakistan," he said, but added that the border region was still a safe haven for many terrorist groups.

"We understand that the governments in Afghanistan and Pakistan know this themselves and have made efforts in the past to work together to try to address that threat," the spokesman said.

“There’s a shared interest there, and that’s what we’re focused on,” Kirby told the daily press briefing. “We understand that that effort also has not always gone smoothly, and we continue to urge those two governments to work together” to eliminate the safe havens along the border region.

"We understand that that effort also has not always gone smoothly, and we continue to urge those two governments to work together along that spine to eliminate the safe havens that so many groups there still enjoy, because those groups are targeting both Afghan and Pakistani civilians - innocent people that continue to die and be maimed by these groups," Kirby said.

"So there's a shared interest there, and that's what we're focused on. We are not focused on lines on the map; we're focused on lines of effort to go after these groups by both governments," he said.

AFP adds: US Defence Secretary Ashton Carter reiterated Washington's support for "courageous" Afghan security forces Tuesday, days after the United States and NATO pledged to keep thousands of troops in the troubled country.

Carter's cautious praise came as President Ashraf Ghani welcomed the "environment of trust" between Washington and Kabul at a joint news conference in the Afghan capital. "The Afghan security forces have demonstrated the motivation, the will and the resilience in the face of a persistent enemy," Carter said.

"I have confidence in the ability of the Afghan forces... and I commend them for fighting courageously last year during a tough fighting season."

But Carter offered a blunter assessment to US troops at Bagram air base north of Kabul, saying that without international financial and military support "Afghan forces aren't going to be able to solidify their control over the country".

"And this democratic national unity government ain't going to be able to do it," he added, hours after his meeting with Ghani. "Everybody knows that."

The Pentagon chief's unannounced visit follows a renewed commitment to Afghanistan from NATO, which said over the weekend it would keep forces there until the end of 2017 at least.

Most are American, but around 40 countries have deployed troops there. Their official role is to train Afghan forces, which are now responsible for their country's security.

Despite a massive, nearly 15-year international effort to defeat the Taliban, the resurgent group controls large areas of Afghanistan and has vowed to keep fighting until foreign forces leave.

Both Carter and Ghani also addressed the role of Afghanistan's neighbour Pakistan, long accused by Kabul of sponsoring militants including the Taliban.  Taliban chief Mullah Akhtar Mansour was killed by a US drone in Pakistan earlier this year in a strike that Islamabad said violated its sovereignty.

But Carter, while stressing the US would work with Pakistan "wherever it can" on extremism, warned that Washington would "continue to target and strike terrorist leaders everywhere in the world where they might threaten Americans or our interests and our friends".

"Pakistan has a fundamental decision to make," added Ghani, who has loudly demanded in the past that Pakistan take action against the Taliban. "There is no difference between good terrorists and bad terrorists."

President Barack Obama, elected eight years ago on a pledge to end the wars in Afghanistan and Iraq, has been unable to do so given the fragile security situations in both countries.

Last week he dialled back plans to cut US troop numbers in Afghanistan from 9,800 to 5,500 by the end of the year.

Instead, around 8,400 US troops will remain, providing training and air support to the Afghans.  Obama has also relaxed its rules of engagement, making it easier for US troops to target the Taliban.

Local forces took the lead in providing security in 2015, but are struggling to contain Taliban offensives and prevent attacks from the Islamic State group and Al-Qaeda.

More than 5,000 Afghan security forces were killed last year, and attacks continue. The Taliban claimed responsibility last month for a suicide attack that killed more than 30 Afghan police cadets in Kabul.

Further complicating matters is endemic corruption and allegations of rights abuses.

"Corruption is as dangerous as terrorism," Ghani said Tuesday, vowing to account for every penny "with full transparency".

About 13,000 NATO troops, most of whom are American, are stationed in Afghanistan under Operation Resolute Support to train and assist Afghan security forces.

NATO has agreed about 12,000 will stay until at least 2017, though in reality local troops are likely to need foreign support and funding for years to come.

In return, NATO is demanding reforms of the Afghan security forces.

Carter's visit followed a brief trip to Baghdad on Monday, where he pledged hundreds of additional US troops to assist Iraqis fighting the IS group.