"We lost 17 men and unfortunately 35 were also wounded and these have all been transported for medical care in the region of Segou," Defence Minister Tièman Hubert Coulibaly said on state television.
Islamist militants kill 17 soldiers in attack on army base
The attack is the biggest for months on the army in Mali, a country that faces a growing threat from Islamist groups based in the desert north.
"We will make sure that this coordinated terrorist attack ... is met with an appropriate response," he said, adding that the army controls the town and is hunting the militants.
Army spokesman Souleymane Maiga told Reuters the raiders briefly took control of the base in Nampala, which is set in semi-desert scrubland close to the Mauritanian border. He said Malian troops retreated to nearby Diabaly to regroup.
Maiga said three groups staged the raid: Al Qaeda in the Islamic Maghreb attacked from the north, the Macina Liberation Front linked to Ansar Dine waited outside the town to ambush military reinforcements and an ethnic Peul group attacked from the southeast.
His comments tie in with a claim of responsibility by Ansar Dine, which said its Macina Battalion staged the raid. A Malian intelligence source told Reuters the militants took seized weapons and vehicles to a forest.
Mali is awash with guns and is home to rival armed groups nursing local grievances. The country has seen a surge in violence since a 2015 peace agreement, which has failed to prevent violence between different ethnic factions.
French forces intervened in 2013 to drive back Islamist fighters who had hijacked a Tuareg uprising in 2012 to take over the desert north. Despite 11,000 U.N. peacekeepers deployed since, militants launch attacks across Mali and its neighbours.
Militants also killed 20 people last November in a high-profile attack on a hotel in the capital.
Earlier, a donor-funded national radio station, Studio Tamani, said it had received a phone call from a new militia defending the ethnic Peul.
The station said the call came from The National Alliance for the Safeguarding of Peul Identity and the Restoration of Justice (ANSIPRJ), headed by Oumar Aldjana.
If confirmed, it would be the first time the group, which was set up last month and includes some who fought alongside the Islamists, has launched an attack.
JOIN OUR PULSE COMMUNITY!
Eyewitness? Submit your stories now via social or: