The former presidential candidate met with Afghan president Ashraf Ghani and his chief executive officer Abdullah Abdullah in separate meetings during his visit on Thursday.

The vast majority of American and NATO combat troops will withdraw from Afghanistan on Dec. 31, leaving local forces to battle increasingly bold Islamic militants seeking to take advantage of the potential security vacuum.

Ghani praised the sacrifices of the U.S. troops during their 13 years in Afghanistan, while McCain emphasized America’s long-term support for the country, according to a statement released by the presidency.