Donald Trump has agreed to send as many as 4,000 additional US troops to Afghanistan to tackle a steadily deteriorating security situation in the beleaguered country, according to senior officials quoted in American media.

The report comes ahead of a pre-planned speech by the President on Monday evening to spell out his policy for Afghanistan. Mr Trump and his advisors had signaled for days that a decision on the president's Afghanistan strategy was forthcoming.

In agreeing to boost troop levels in Afghanistan, Mr Trump has cemented America's continuing involvement in a conflict that has now stretched across three presidential administrations and nearly two decades.

His decision to do so marked a stark reversal from Mr Trump's position during the Obama administration, when Mr Trump repeatedly urged America to pull its forces from a conflict he characterized as intractable and costly.

Afghanistan scarcely figured in the 2016 presidential campaign. Without specifically articulating a vision for America’s role in the war-convulsed country, Mr Trump’s foreign policy emphasized scaling back involvement in conflicts abroad and curbing the spread of Islamic extremism. His first major speech on the subject rejected “nation-building”, and in accepting the Republican nomination he warned that “the situation [in the Middle East] is worse than it has ever been before” despite years of costly American intervention.

“We don't want to have a depleted military, because we're all over the place fighting in areas that just we shouldn't be fighting in,” Mr Trump said in a December speech after winning the election. “We have spent, at last count, $6 trillion in the Middle East, and our roads have potholes all over. Our highways are falling apart. Our bridges are falling.”

But Mr Trump and his advisors have said in recent weeks that the turbulent situation in Afghanistan requires a response. Defense Secretary Jim Mattis flatly told Congress in June “we are not winning in Afghanistan,” echoing the concerns of military officials who had told lawmakers they needed more troops, and Mr Trump told reporters earlier this month that “I took over a mess and we’re going to make it a lot less messy.”

In the years leading up to his presidential run, Mr Trump frequently assailed America’s presence in Afghanistan for squandering lives and money. He repeatedly said on Twitter that America should “get out” of Afghanistan, writing in early 2013 that the departure should happen “immediately.”

Once he became a contender for the 2016 nomination, Mr Trump moderated that stance. While he called the decision to invade Afghanistan “a terrible mistake” in 2015 - a criticism he disavowed late that month - he supported keeping troops in Afghanistan to prevent a “collapse”.

“I think it's important, number one, that we keep a presence there and ideally a presence of pretty much what they're talking about - 5,000 soldiers,” Mr Trump said at the time.

Multiple presidents have struggled with America’s entanglement in Afghanistan, now the country’s longest war. After first pouring additional service members into the country and then pledging to slim America’s commitment there to 5,500 troops by the end of his term, Barack Obama announced last summer that he would leave 8,400 service members there as a bulwark against terrorism.