Media playback is unsupported on your device Media caption In August President Trump said: "We are not nation building again. We are killing terrorists"

US Defence Secretary Jim Mattis says the US will send 3,000 extra troops to Afghanistan as the Taliban gain ground and security deteriorates.

American combat operations against the Taliban officially ended in 2014, but over 8,000 US special forces remain in the country backing Afghan troops.

US President Donald Trump last month signalled he would keep US boots on the ground indefinitely.

The Taliban pledged to turn Afghanistan into a "graveyard" for foreign forces.

Mr Mattis confirmed the deployment on Monday, speaking to reporters at the Department of Defense.

Read more on Trump's presidency:

It follows a request in February from the senior US commander in Afghanistan, General John Nicholson, for several thousand additional troops to help the struggling Afghan security forces.

The decision to send more troops to Afghanistan caps a change of heart for Mr Trump on America's longest war.

During the Obama administration, he repeatedly called for the US to withdraw from Afghanistan.

But once he became a frontrunner for the 2016 Republican presidential nomination, Mr Trump modified his stance.

He said the 2001 US-led invasion of Afghanistan was "a terrible mistake", but supported keeping troops in the country to prevent a "collapse".

Last month he said the US would remain in the country to kill terrorists rather than nation-build.

At peak deployment levels in 2011, there were some 100,000 US personnel in the country.

Sixteen years after the US-led invasion, the Afghan government still only controls half of the country.