Speaking at Fort Myer in Arlington, Va., Trump acknowledged that the U.S. war in Afghanistan is "the longest war in American history" and said he shares many Americans' frustration with its longevity.
But Trump, who ran for president on a platform that expressed skepticism of the U.S.'s interventionist foreign policy, also said that being president changed his opinions on what would be the best strategy going forward.
"My original instinct was to pull out, and historically I like following my instincts," Trump said. "But all my life, I have heard that decisions are much different when you sit behind the desk in the Oval Office. In other words, when you are president of the United States."
Instead of pulling out, Trump said he now believes "the consequences of a rapid exit are both predictable and unacceptable" and that a "hasty withdrawal would create a vacuum that terrorists, including ISIS and al-Qaida, would instantly fill, just as happened before September 11."
After signaling a commitment to keep the 17-year war in Afghanistan going, Trump singled out Pakistan, which he blamed for harboring terrorist organizations.
"For its part, Pakistan often gives safe haven to agents of chaos, violence, and terror," Trump said. "The threat is worse because Pakistan and India are two nuclear-armed states, whose tense relations threaten to spiral into conflict, and that could happen."
While Trump made his philosophy clear, he hesitated to give details, explaining that publicly disclosing that knowledge would be harmful to the United States and beneficial to its enemies.
"We will not talk about numbers of troops or our plans for further military activities," he said. "Conditions on the ground, not arbitrary timetables, will guide our strategy from now on. 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."
However, White House officials have said that Trump plans to increase troop levels in Afghanistan by approximately 4,000 -- a rise of about 50 percent.
Presently, there are about 8,400 U.S. troops in Afghanistan to train, advise and assist Afghan security forces.
A day before Trump's speech, U.S. Secretary of Defense James Mattis said the president made his decision on Afghanistan after a "sufficiently rigorous" strategic process.
"He wants to be the one to announce it to the American people," Mattis told reporters while traveling to Jordan. "He now needs the weekend to collect his thoughts on how he's going to explain it."
Trump previously delegated authority to Mattis' Defense Department on determining troop levels in Afghanistan.