Mattis’s comments come as questions mount in the US media about what happened on October 4, and criticism over President Donald Trump’s handling of the aftermath.
The Pentagon boss said the body of Sergeant La David Johnson was “found later” by non-US forces following the ambush, which is thought to have been conducted by jihadists in an area where an Islamic State group affiliate operates.
US officials earlier had told CNN that Johnson’s body was not recovered for nearly 48 hours.
“The US military does not leave its troops behind, and I would just ask that you not question the actions of the troops who were caught in the firefight and question whether or not they did everything they could in order to bring everyone out at once,” Mattis said.
As is routine in incidents where troops are killed, the Pentagon has opened an inquiry into the soldiers’ deaths.
Because the military was not expecting hostile action, it fell to French forces conducting anti-jihadist operations in the region to provide air support after the ambush.
This included fighter aircraft, helicopter gunships and a medivac helicopter that air-lifted the wounded.
Mattis said a contract aircraft had evacuated the bodies of those killed in action.
The Americans had been on a joint patrol with Nigerien counterparts they were training when they were ambushed by motorcycle-riding and car-driving gunmen in the Tillaberi region in the Niger’s southwest.
At least four Nigerien troops also died.
Trump has faced criticism for not immediately publicly addressing the attack, then falsely claiming that Barack Obama and other former US leaders did not call the families of fallen soldiers.
He then was accused of disrespecting Johnson’s family in a condolence call.
During a Pentagon briefing, Lieutenant General Kenneth McKenzie said the US troops had conducted 29 previous patrols in the region and had no reason to expect an ambush.
Separately, National Security Adviser HR McMaster cautioned against jumping to any premature conclusions about the incident.
“In the military, the first report is always wrong,” he said.