Updated

U.S. Defense Secretary Ash Carter on Friday made an unannounced visit to Afghanistan to consult with military commanders and deliver a pre-holiday pep talk to U.S. troops.

It is Carter's last planned trip to Afghanistan before handing off his Pentagon responsibilities to his designated successor, retired Marine Gen. James Mattis. Carter is scheduled to meet later in the day with Afghan President Ashraf Ghani.

More on this...

The U.S. has about 10,000 troops in Afghanistan to train and advise Afghan security forces combatting a resilient Taliban insurgency. U.S. special operations forces are hunting down Al Qaeda and Islamic State militants.

Carter's visit comes amid concerns that despite improvements in Afghan government defenses, Taliban forces are gaining leverage and are continuing to use neighboring Pakistan as a sanctuary. By U.S. estimates, the Afghan government controls slightly less than two-thirds of the country's population.

The Taliban holds sway over about 10 percent, and the remainder of the population is "contested."

U.S. commanders have praised Afghan soldiers for taking the lead in battles against the less-well equipped Taliban, but they have been suffering heavy casualties across the country.

Prior to Carter's arrival, his press secretary, Peter Cook, said Carter wants to get a full rundown on operations. "In his meetings with senior Afghan officials, the secretary will discuss the growing capabilities and resilience demonstrated by Afghan security forces in recent months," Cook said. "He will also discuss ongoing efforts to continue building Afghan combat capacity including aviation."

President Barack Obama had planned to reduce U.S. troop numbers to about 1,000 by the time he left office in January, but he scrapped that approach in the face of Taliban gains.

The U.S. military has been in Afghanistan since it led an invasion force in October 2001 to overthrow the Taliban regime. The U.S. has suffered more than 2,200 deaths in Afghanistan, including more than 1,800 killed in action, since the war began.

President-elect Donald Trump has not said how he will approach the Afghanistan problem but has denounced what he calls U.S. nation-building projects.