The visit, which was not announced in advance due to security concerns, comes as the USA injects new resources into the stalemated war.
Before landing in the Afghan capital, Mattis told reporters that the United States was picking up signs of interest from groups of Taliban fighters in exploring the possibility of talks to end the violence, adding that the signs date back several months.
Afghanistan's President Ashraf Ghani recently offered a comprehensive peace deal to the Taliban, but the militants have not responded and have increased their attacks. "We've had some groups of Taliban - small groups - who have either started to come over or expressed an interest in talking".
In exchange for these provisions, Ghani said the Taliban should officially recognize the Western-backed Afghan government and the country's constitution.
The group has insisted it would only negotiate with the United States, which it calls a "foreign occupying force".
Sanofi, Regeneron offer price cut for cholesterol drug Praluent
We're willing to work in their [price] range, providing that payers agree to reduce their burdensome barriers for patients". The study is the second of its kind-following a similar, 27,564-patient trial from Amgen past year .
Ghani's offer of peace talks comes as civilian casualties have soared in recent months, with the Taliban increasingly targeting towns and cities in response to Trump's new and more aggressive military policy.
The president also said the government will provide passports for Taliban members and their families, along with office space in Kabul.
Thanks to the political process, Mattis said America is now looking towards victory in Afghanistan after more than 16 years of conflict. The group ruled Afghanistan until 2001 when it was defeated by a U.S. -led troops in the wake of the September 11 attacks and it is fighting to restore Islamic rule in the country.
The defence secretary, who commanded U.S. troops as a Marine general in southern Afghanistan during the war with the Taliban in 2001, said that getting the militants on board for reconciliation may be a bridge too far.
"It's all working to achieve a political reconciliation, not a military victory", Mattis said.