The US backs France's Operation Barkhane, under which its military is fighting Islamists in five countries across the Sahel region.
"I have no doubt that the French will continue to make their own decisions in their own best interest and that the terrorists will not enjoy these decisions," Mattis told reporters in the Horn of Africa nation, which hosts Washington's only permanent military base on the continent.
"They have always proven that they will stand up when it is time to stand against something like this."
The US backs France's Operation Barkhane, under which its military is fighting Islamists in five countries across the Sahel region -- Mauritania, Mali, Chad, Niger and Burkina Faso -- alongside African allies.
"We look for our partners in that part of the continent to really carry the fight there," General Thomas Waldhauser, commander of US forces in Africa, told a press conference with Mattis.
The Americans have notably been providing air refuelling for French planes and exchanging intelligence with the French forces.
Projections showed Sunday that centrist candidate Emmanuel Macron and far-right leader Marine Le Pen are set to go through to France's presidential run-off on May 7.