President Donald Trump cleared the way for the deployment of thousands more US troops to Afghanistan on Monday, backtracking from his promise to swiftly end America's longest war, while pillorying ally Pakistan for offering safe haven to “agents of chaos”.

In his first formal address to the nation as commander-in-chief, Trump discarded his previous criticism of the 16-year-old war as a waste of time and money, admitting things looked different from “behind the desk in the Oval Office”. He was speaking in front of US troops at Fort Myer, just outside Washington.

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

Examine: Pakistan’s anxiety

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.

A conflict that began in October 2001 as a hunt for the 9/11 attackers has turned into a vexed effort to keep Afghanistan's divided and corruption-hindered democracy alive amid a brutal Taliban insurgency.

Trump 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 indicated that single-minded approach would extend to US relations with troubled ally Pakistan, which consecutive US administrations have criticised for links with the Taliban and for harbouring leading militants.

“We can no longer be silent about Pakistan's safe havens for terrorist organisations,” he said, warning that vital aid could be cut.

“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.”

Also read: US Centcom chief stresses sustained ties with Pakistan

Ahead of the speech, the Pakistan Army had brushed off speculation that Trump could signal a stronger line against Islamabad, insisting the country has done all it can to tackle militancy.

“Let it come,” Inter-Services Public Relations Director General Maj Gen Asif Ghafoor told reporters, referring to Trump's decision. “Even if it comes... Pakistan shall do whatever is best in the national interest.”

In advance of the announcement, Vice President Mike Pence called Afghan President Ashraf Ghani and Trump's Secretary of State Rex Tillerson made calls to his Pakistani, Indian and Afghan counterparts.

About face

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 US would “stand ready to support peace talks between the Afghan government and the Taliban without preconditions”.

While wary of international entanglements, Trump has also been eager to show success and steel in the realm of national security. As president, he has surrounded himself with military generals — from his national security advisor to his chief of staff to his defence secretary — who have urged him to stay the course.

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.

His new policy will raise questions about what, if anything, can be achieved by making further deployments, or repeating the demands of previous administrations in more forceful terms.

In 2010, the United States had upwards of 100,000 US military personnel deployed to Afghanistan. Today that figure is around 8,400 US troops and the situation is as deadly as ever.

More than 2,500 Afghan police and troops have been killed already this year.

“The Afghan government remains divided and weak, its security forces will take years of expensive US and allied support to become fully effective, and they may still lose even with such support,” said Anthony Cordesman of The Center for Strategic and International Studies.

Hours before Trump's remarks there was a stark reminder of the Taliban's reach, when a missile landed on a field in Kabul's heavily fortified diplomatic zone.

New ultimatum on India

Much of Trump's address on turning around America's longest war sounded familiar, not least on the need for Pakistan to crack down on Taliban fighters seeking sanctuary across Afghanistan's border.

More surprising was Trump's call on India and how he linked Afghanistan to totally separate US-Indian trade matters.

Trump said the US appreciates India's important contributions to Afghan stability. But he lamented that India “makes billions of dollars in trade with the United States.” He said he wants India to provide more economic assistance and development to Afghanistan.

'Rigorous debate'

Trump's announcement comes amid a month of serious turmoil for his administration, which has seen several top White House officials fired and revelations that members of Trump's campaign are being investigated by a federal grand jury.

He sought in his address to convince Americans weary of his controversial off-the-cuff remarks. He also sought to pre-empt a backlash from his base who shared his previous disdain for military entanglements on foreign soil.

“I studied Afghanistan in great detail and from every conceivable angle,” he said, hoping to show he has sufficiently pondered the decision to send more young Americans into mortal danger.

One of the main voices arguing for withdrawal, Trump's nationalistic chief strategist Steve Bannon, was removed from his post on Friday.

His strategy did, however, win over national security-focused Republicans with whom he has had strained relations.

Senator John McCain described the strategy as “a big step in the right direction”.

Democrats meanwhile voiced concern with what House minority leader Nancy Pelosi called “an open-ended commitment of American lives with no accountability to the American people”.

“President Trump says there will be no ceiling on the number of troops and no timeline for withdrawal,” she said.