Mattis underscored at a news conference Monday that the purpose of his visit was to help inform his recommendations on America's strategy in Afghanistan moving forward, but he declined to share what those recommendations might be.
He did say, "We are under no illusions about the challenges associated with this mission," adding that "2017 is going to be another tough year for the valiant Afghan security forces and the international troops who have stood and who will continue to stand should to shoulder with Afghanistan against terrorism."
Mattis called the attack on unarmed soldiers at a mosque and dining facility proof that the insurgent group was a "barbaric enemy," saying of the Taliban, "These people have no religious foundation, they are not devout anything, and it shows why we stand with the people of this country against such heinous acts."
A senior US military official said Monday that the US had intelligence that the Haqqani network, a branch of the Taliban known for complex attacks, was likely behind the assault.
The official added that the attack probably took "four to six months" to plan given its complexity, another factor that pointed to the Haqqani network's involvement.
US officials have long said that the Haqqani group has enjoyed sanctuary in neighboring Pakistan, allowing it to launch attacks inside Afghanistan. The US has repeatedly asked the Pakistani government to crack down on the terror group.
The defense secretary was due to meet with his Afghan counterpart, but hours before Mattis touched down in Kabul, Ghani announced that his defense minister and army chief of staff had resigned.
The senior military official said the resignations were "not a surprise" given Ghani's emphasis on establishing accountability for security officials. The official said that replacements had been sought since the ISIS-claimed attack on a military hospital earlier this year.
Mattis's visit to Afghanistan follows meetings in Saudi Arabia, Egypt, Israel, Qatar and Djibouti.
US troops have been fighting for nearly 16 years in Afghanistan, where the government and its coalition allies are battling a resilient Taliban as well as other terror groups including ISIS.
Attacks and counterattacks
American forces enjoyed a brief victory last week, when the US military said Taliban leader Quari Tayib was killed in an airstrike in Kunduz province.
But it was followed by Friday's attack at Camp Sheehan. The slaughter lasted around six hours. By the end, at least five attackers were killed and one was arrested, Afghan army spokesman Abdul Qahar Araam said.
He said Afghan soldiers and security forces "have my personal assurance that we will continue to stand with them."
Asked about the massive airstrike in Nangarhar Province, Nicholson said, "We were sending a very clear message to ISIS, not only ISIS in Afghanistan but ISIS main, if they come here to Afghanistan they will be destroyed."
Security situation 'a stalemate'
In February, Nicholson told the Senate Armed Services Committee that leadership assesses "the current security situation in Afghanistan as a stalemate."
He cited the government's stability; Afghan military casualties; the influence of Pakistan, Russia and Iran; "the convergence" of various terror groups; the narcotics trade and corruption.
There are 8,400 US troops in Afghanistan and 6,000 troops from NATO and allied counties. Nicholson said the coalition faces "a shortfall of a few thousand troops" to break the "stalemate."
Insurgent gains
Casualties among international troops have dropped dramatically since the NATO-led effort shifted from a combat role to an advisory role in 2014.
The agency's analysis of information from US forces in Afghanistan "suggests that the security situation in Afghanistan has not improved this quarter."
"The numbers of the Afghan security forces are decreasing, while both casualties and the number of districts under insurgent control or influence are increasing," according to the January 30 report to Congress.
CNN's Ehsan Popalzai, Jason Hanna and Joe Sterling contributed to this report.