Thousands of Muslims rallied peacefully in northern Nigeria on Saturday to demand the return of Egypt's Islamist former president Mohamed Morsi, ousted by the military early last month.

Around 4,000 demonstrators carrying banners and placards chanted pro-Morsi songs and slogans outside a mosque in northern Nigeria's biggest city, Kano, an AFP reporter witnessed. Organisers put the number of protesters at 5,000.

Egypt has been rocked by political unrest since Morsi's ouster in a July 3 military coup after massive protests against him.

"We call for the immediate release of president Mohamed Morsi and all political prisoners being detained by the illegitimate Egyptian authorities," protest leader Sheikh Abubakar Mujahid told reporters.

"Morsi must return to his position as president."

Nigeria, Africa's most populous nation of 160 million people, is evenly divided between a mainly Muslim north and predominantly Christian south.

It is grappling with a four-year insurgency by Islamist group Boko Haram mainly in the country's northeast.

The violence has claimed some 3,600 lives, including killings by security forces, which launched a military offensive in May to try to end the insurgency.