Thousands of pilgrims come to Timbuktu for the prophet's birthday and an official said the accident might have been caused by obstacles resulting from renovation work on the 14th-century mosque made largely from mud.
"The mosque is being renovated, financed by the Aga Khan, and the work is carried out by South African specialists," an official at Timbuktu town hall told AFP, asking not to be named.
"Because of these renovations, the passage on the north side of the mosque is closed off. On that side, to get through, the faithful found an improvised alleyway.
"But the alley couldn't take the number of people using it. So there was a stampede. Somebody shouted 'someone has died' and panic took over."
Two other officials said rescue services had "very quickly" helped the "many injured".
"We're in mourning. What happened is a real drama. We accept the will of God. He gives us life, he takes it away," said the mosque's imam, who gave his name as Asseyuti.
Timbuktu was famous for being an intellectual and religious centre during the 15th and 16th centuries, helping to spread Islam throughout Africa.
It remains synonymous in Europe with the idea of an exotic faraway land, but the town's historic buildings require constant renovation.