Several websites published a statement from the group on Wednesday claiming that they undertook the attack.
The statement said that the 12 soldiers had been taken prisoner and that: "This jihadist operation targeted the allies of the Americans, the crusaders on Islamic Mauritanian territory occupied by infidels."
Low-level violence has been ongoing for more than a year in Mauritania.
The government has blamed these attacks on groups linked to al-Qaeda.
Al-Qaeda in the Islamic Maghreb killed four French tourists last year and has called for a holy war to avenge the overthrow of the democratically elected President Sidi Ould Cheikh Abdallahi by the military.