The setting for Mr. Trump’s speech — a flag-bedecked stage — was calculated to cloak the president in the mantle of a commander in chief. But Mr. Trump read stiffly from a teleprompter and his words lacked the rhetorical flourishes of other wartime presidents.

Mr. Trump promised to launch an intensive diplomatic and economic initiative, but he does so from a position of acute weakness at the State Department, which has yet to place an ambassador in Kabul, Afghanistan’s capital, and scrapped the office of the special representative for Afghanistan and Pakistan.

Mr. Trump’s reference to a strategic partnership with India also has implications for Pakistan, which has a deeply antagonistic relationship with its neighbor.

An estimated 8,400 American troops are currently stationed in Afghanistan, most assigned to an approximately 13,000-strong international force that is training and advising the Afghan military. About 2,000 American troops are tasked with carrying out counterterrorism missions along with Afghan forces against groups like the Islamic State’s Afghan affiliate, the Islamic State in Khorasan.

Mr. Trump’s aides, previewing the speech, said it would include new steps to pressure neighboring Pakistan to shut down the sanctuaries there for the Taliban and other militants, a goal Republican and Democratic administrations have pursued for years with little success.

They also said that continued American military involvement and economic assistance in Afghanistan would be contingent on steps by the country’s leaders in Kabul to rein in rampant corruption — another Western aspiration that has repeatedly been dashed in the country, parts of which have been largely lawless for decades.

The strategy comes with steep risks for Mr. Trump, potentially increasing American troops without yielding many military gains in a conflict that has proved intractable. Still, United States military and intelligence officials have argued that doing nothing in Afghanistan, where the Taliban are increasingly gaining ground, is not an option.