"We can no longer be silent about Pakistan's safe havens for terrorist organizations," Mr. Trump said.

President Donald Trump cleared the way for the deployment of thousands more U.S. 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, Mr. 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."

"My instinct was to pull out" he admitted as he spoke of frustration with a war that has killed thousands of U.S. troops and cost U.S. taxpayers trillions of dollars. But following months of discussion, Mr. Trump said he had concluded "the consequences of a rapid exit are both predictable and unacceptable" and leaving a "vacuum" that terrorists "would instantly fill."

While he refused to offer detailed troop numbers, senior White House officials said he had already authorized his defense 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.

Mr. 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."

Mr. Trump indicated that single-minded approach would extend to U.S. relations with troubled ally Pakistan, which consecutive U.S. administrations have criticized for links with the Taliban and for harboring leading jihadists -- like Osama bin Laden.

"We can no longer be silent about Pakistan's safe havens for terrorist organizations," 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."

Ahead of the speech Pakistan's military brushed off speculation that Mr. Trump could signal a stronger line against Islamabad, insisting the country has done all it can to tackle militancy. "Let it come," army spokesman Major General Asif Ghafoor told reporters, referring to Trump's decision. "Even if it comes... Pakistan shall do whatever is best in the national interest."