Mauritanian President Mohamed Ould Abdel Aziz was shot and "slightly wounded" on Saturday when an army unit accidentally fired on his convoy, the government said.
However, a military source said earlier the president had been directly targeted.
Abdel Aziz is being treated in hospital in the capital Nouakchott, Communications Minister Hamdi Ould Mahjoub said.
"This was an accidental shooting on the presidential convoy as it returned to Nouakchott. The army unit did not recognize the presidential convoy," Mahjoub said on national television.
"The Mauritanian people can be reassured, the president is fine... He was slightly wounded, and he got out of the vehicle unassisted upon arrival at the hospital, where he walked in without difficulty."
Earlier, a security source told AFP that Abdel Aziz was hit in the arm by a bullet that an unknown gunman fired at him as he was driving from his weekend retreat in nearby Tweila.
The gunman in a car "directly targeted" the head of state, he added, without giving any indications as to the identity of the attacker or the motive.
"The president's life is not in danger, he got out and walked to a military hospital where he received first aid," the source said.
The hospital was placed under high surveillance by the presidential guard.
Opposition lawmakers accuse the former general of despotism and mismanagement and having failed to heed commitments made in the Dakar accords that led to his election in 2009, a year after he seized power in a coup d'etat.
The opposition wants a transition government to take over from Abdel Aziz and find a way out of the crisis, dealing with issues such as unemployment, slavery and attacks on human rights.
Abdel Aziz has insisted he will not resign, despite a series of opposition protests.
"I have no intention of leaving power because I think that in a democracy, change must be done through the ballot box," Abdel Aziz said in August.
He has led a military campaign against Al-Qaeda in the Islamic Maghreb (AQIM).
He has been the subject of several failed assassination attempts by AQIM, Al-Qaeda's franchise in North Africa, according to sources.
AQIM, which stems from a group started in the late 1990s by radical Algerian Islamists, formally subscribed to Al-Qaeda's ideology in 2007, but after a string of high-profile attacks, the Algerian army managed to severely curtail its operations.
It has since been boosted by the turmoil in neighbouring Mali that followed a coup there in March, with hardline Islamists occupying the country's vast northern region.
Abdel Aziz's mandate expires in 2014.