Washington - US President Donald Trump cleared the way for the deployment of thousands more troops to Afghanistan, backtracking from his promise to rapidly end America’s longest war, while lambasting ally Pakistan for offering safe haven to “agents of chaos”.

In the face of a strategic stalemate, Trump outlined a new stance, saying US troops will continue to stay in the region and the fight will become more intense.

In his first formal address to the nation as commander-in-chief late Monday, Trump insisted that the Afghan government, Pakistan, India, and NATO allies step up their own commitment to resolving the 16-year conflict.

Trump indicated that single-minded approach would extend to US relations with Pakistan, which consecutive US administrations have criticised for links with the Taliban and for harbouring leading jihadists - like Osama bin Laden.

In setting out what he described as a new approach to the 16-year campaign, Trump had harsh words for Pakistan, saying Washington could “no longer be silent about Pakistan’s safe havens for terrorist organisations.”

Trump said “Pakistan has much to gain from partnering with our effort in Afghanistan (and) much to lose from harbouring criminals and terrorists.”

Going further, Trump suggested that military and other aid to Washington’s nuclear-armed ally is at stake if it does not clamp down on extremism. “We have been paying Pakistan billions and billions of dollars at the same time they are housing the very terrorists that we are fighting,” he said.

“That will have to change and that will change immediately,” he said. “It is time for Pakistan to dedicate to civilisation and order and peace.”

US Vice President Mike Pence told Fox News the rules of engagement were being changed “so that American commanders on the ground can make real-time decisions” and the United States would continue to target militants’ safe havens in Afghanistan and Pakistan.

“Pakistan has much to gain from partnering with our effort in Afghanistan. It has much more to lose by supporting terrorists. The president has put them on notice,” Pence said in an editorial in USA Today.

To a question, Pence said “What the president said Monday night to Pakistan is that we’re putting them on notice. They need to step up as a partner.” “And if they want to see the United States continue to partner with them for security in the region, they need to do more to confront the terrorist organisations that are using particularly northern Pakistan ... as a safe haven.”

Trump discarded his previous criticism of the 16-year-old Afghan war as a waste of time and money, admitting things looked different from “behind the desk in the Oval Office.”

“My instinct was to pull out,” Trump said as he spoke of his frustration with a war that has killed thousands of US troops and cost US taxpayers trillions of dollars.

But following months of deliberation, Trump said he had concluded “the consequences of a rapid exit are both predictable and unacceptable” leaving a “vacuum” that terrorists “would instantly fill.”

While Trump refused to offer detailed troop numbers, senior White House officials said he had already authorised his defence secretary to deploy up to 3,900 more troops to Afghanistan.

He warned that the approach would now be more pragmatic than idealistic. Security assistance to Afghanistan was “not a blank check” he said, warning he would not send the military to “construct democracies in faraway lands or create democracies in our own image.”

“We are not nation building again. We are killing terrorists.”

Trump for the first time also left the door open to an eventual political deal with the Taliban. “Someday, after an effective military effort, perhaps it will be possible to have a political settlement that includes elements of the Taliban in Afghanistan,” he said.

“But nobody knows if or when that will ever happen,” he added, before vowing that “America will continue its support for the Afghan government and military as they confront the Taliban in the field.”

His Secretary of State Rex Tillerson went further, saying the United States would “stand ready to support peace talks between the Afghan government and the Taliban without preconditions.”

The Trump administration had originally promised a new Afghan plan by mid-July, but Trump was said to be dissatisfied by initial proposals to deploy a few thousand more troops.

“We will fight to win,” Trump said in the speech at Fort Myer in Arlington, Virginia.

“America’s enemies must never know our plans, or believe they can wait us out. I will not say when we are going to attack, but attack we will,” said Trump, before a crowd of US troops.

While Trump said “our troops will fight to win”, he also stressed that ultimately Afghanistan’s police and army must do most of the fighting to defeat the Taliban and allied militants.

“The stronger the Afghan security forces become, the less we will have to do. ... We want them to succeed.”

Trump, who had criticised his predecessor for setting deadlines for drawing down troops in Iraq and Afghanistan, declined to put a timeline on expanded US operations in Afghanistan.

Trump also said he had expanded the US military’s authority for its forces to target militant and criminal networks, warning “that no place is beyond the reach of American arms”.

Nikki Haley, the US ambassador to the United Nations, told CNN that Trump’s strategy for Afghanistan included decisions that “are very different from anything that’s happened before.”

“What we are focused on is results, stomping out terrorism, doing whatever it takes,” she said. “You’ve seen the president do this with ISIS in Syria and Iraq. Now we’re getting ready to do it in Afghanistan.”

In his speech, Trump also called on Pakistan’s regional rival India, to “help us more with Afghanistan, especially in the area of economic assistance and development.”

“We appreciate India’s important contributions to stability in Afghanistan but India makes billions of dollars in trade from the United States and we want them to help us more with Afghanistan, especially in the area of economic assistance and development.”