United States (US) Vice President Mike Pence during a surprise visit to Afghanistan on Friday issued a warning to Pakistan that it has allegedly provided safe haven to terrorists for too long but those days are over now, as President Donald Trump has now "put Pakistan on notice."

This is so far the harshest US warning to Pakistan since the beginning of the Afghan war more than 16 years ago and follows several recent statements, indicating US indignation with Islamabad.

The US vice president made the remarks as he addressed US troops at the Bagram airfield, becoming the most senior Trump administration official to visit the men and women fighting America's longest-ever war.

Pence's remarks earned wild applause from the 15,000 US troops who were excited to see the vice president among them on a surprise Christmas visit.

"For too long has Pakistan provided safe haven to the Taliban and many terrorist organisations, but those days are over," Pence told the troops.

He reiterated word for word President Donald Trump's warning that Pakistan must stop offering cross-border safe havens to Taliban factions and armed militant groups fighting US troops and their Afghan allies.

"President Trump has put Pakistan on notice. As the President said, so I say now: Pakistan has much to gain from partnering with the United States, and Pakistan has much to lose by continuing to harbor criminals and terrorists," the US VP added.

In August, President Trump outlined a new strategy to win America’s longest war.

Explore: What is Ashraf Ghani's plan to end Afghanistan's 40-year conflict?

The new US strategy for Afghanistan shows that Pakistan’s strategic position stokes Washington’s desire for a close relationship with Islamabad but it also undermines the relationship between the two countries.

This key element in the US approach to Pakistan is highlighted in the national security strategy that President Trump released this week and also in the Pentagon’s latest report to Congress on the situation in Afghanistan.

Read more: Pakistan ‘obliged’ to help US, says Trump

The national security strategy questions Pakistan’s ability to protect its nuclear assets, asks it not to indulge destabilising behaviour in Afghanistan reminds and insist that Islamabad is obliged to help Washington in Pakistan because it receives "massive payments" every year.

On Thursday, the National Command Authority expressed full confidence in the country’s ability to protect the nation's strategic assets, and reiterated that as a responsible nuclear state, Islamabad will keep improving its nuclear security as well as non-proliferation measures.

Read more: Indian nuclear security measures weaker than Pakistan's: report

Earlier this month, US Secretary of State Rex Tillerson warned Pakistan that it could lose control of its territory if it did not sever ties with the Haqqanis and other terrorists.

Pakistan has rejected these allegations as baseless and insists that it has cleared all terrorist hideouts from its soil in recent military operations.

It has also denied having a soft corner for the Haqqani network, and has reiterated that it targets all terrorist groups without discrimination.

Last week, the Pentagon informed Congress that it would take 'unilateral steps' in areas of divergence with Pakistan while expanding cooperation between the two countries where their interests converge.

The Pentagon’s report to Congress emphasises another key point that is missing from the nation security strategy: the need for cooperation between Pakistan and Afghanistan.

"Increased collaboration between Afghanistan and Pakistan is critical to maintaining pressure on militant and terrorist groups and for meeting the enduring security requirements on both sides of the shared border," says the report.

The Pentagon has noted that the Afghanistan-Pakistan relationship remains tenuous and leaders from each country continue to accused the other of harbouring terrorists and allowing the planning of attacks from their soil.

It told US lawmakers that Washington continues to encourage both countries to work together to solve common problems, such as border security, "but deep-rooted mistrust remains a significant barrier to progress."

The Pentagon argued that this trust deficit results "from Pakistan’s support of and inaction against Afghan-oriented extremists, and Pakistan’s concerns about terrorist attacks launched from Afghanistan" and it also hampers the bilateral military collaboration required to achieve enduring security.

The Pentagon also pointed out that despite tensions in the bilateral relationship, and periodic border closures, Afghanistan-Pakistan border cooperation at the tactical level took positive steps in 2017. They maintained constructive dialogue and informally operationalised border management mechanisms.

During this period, multiple general officer-level engagements continued and maintained open communications, enhanced information sharing, and facilitated some military-to-military cooperation along the border, the Pentagon adds

The report to Congress also mentions that Pakistan has contributed operational support to a combined US and Afghan operation to combat the militant Islamic State group.

Pence's visit cloaked in secrecy

Pence's visit from Bagram to central Kabul, where he met Afghan President Ashraf Ghani and Chief Executive Abdullah Abdullah ─ both of whom the US is counting on to help rebuild the war-shattered country ─ was in doubt until the last moment, when a White House official said he countermanded a decision that the weather was not clear enough to travel.

Even then, Pence's helicopter flight took place in near total darkness, moving low and fast and with a heavy phalanx of secret service and special forces.

The White House official said the decision was made "out of respect. To meet with Ghani and Abdullah."

The Trump administration, like Barack Obama's before, has put enormous hope in Ghani, who is seen by the White House as more competent and less corrupt than his predecessor Hamid Karzai.

But his three-year-old “national unity” government appears to be faltering and parliamentary elections have been repeatedly postponed.

Pence had been expected to visit Egypt and Israel this week, a trip that was delayed amid a crunch vote on tax cuts and deadly protests at Trump's decision to recognise Jerusalem as Israel's capital.

Taliban on the run?

As he thanked the US troops for their service, VP Pence told them that they have put the Taliban on the run.

"The American people deserve to know that with the courage of everyone gathered here, we're making real progress in this fight for freedom in Afghanistan," Pence told the troops.

"We've dramatically increased American air strikes. And together with our Afghan partners, we've put the Taliban on the defensive," he said, also pointing at efforts to target the drug trafficking networks that help fund the Taliban.

"All across this country we've won new victories against the terrorists, no matter what they call themselves or where they try to hide."

"And never doubt that your mission ─ your mission here in Afghanistan ─ is vital to the safety and security of the American people," Pence said.

The superpower's vexed campaign against Al Qaeda and the Taliban ─ born from the rubble of the 9/11 attacks on New York and Washington, receives ever-less public attention in the US these days.

With typical certitude, the 45th commander-in-chief promised a nation "weary of war without victory" a more ruthless campaign, and one without Obama-era exit deadlines or niceties.

Pence's visit was designed to shift the spotlight back on personnel and their mission, however briefly, before Americans turn their focus to turkey lunches, festive cheer and contentious domestic politics.

But the trip comes as Afghan security forces struggle to beat back the Taliban, which has been on the offensive since the withdrawal of US-led NATO combat troops at the end of 2014 and maintains control over swathes of the country.

And the fact that Pence's visit took place in secrecy and under cover of winter darkness is a stark reminder of the difficult security situation even around Kabul and even after a war effort worth more than half a trillion dollars.

Later asked by reporters whether the US would consider raising its military presence in the country, Pence demurred.

"That will be a decision for the commander in chief in the days ahead, but again this is... not just personnel," he said.

"You know, I said today that bureaucrats don't win wars, soldiers do. And one of the things that you have seen in President Trump, as commander in chief, is he has empowered our battlefield commanders to make real-time decisions," he continued, citing successes against the IS in Iraq and Syria.