"Everyone has the right to go to another country to try their luck," the 31-year-old former fish exporter from Senegal told AFP.
"Lots of people are trying to reach Europe, but some end up staying to make a living."
Seven out of 10 West Africa-born migrants stay on the continent, according to a December study by the Moroccan think tank OCP Policy Center.
After Austria, Denmark set to become next European country to ban burqas
Discouraged by the danger of passing through countries such as Libya and by harsh policies aimed at preventing migrants going to Europe, many settle in "transit" countries including Morocco.
Ndiaye said he gave up after he realised reaching Spain was "too hard".
He took on several informal jobs and finally set himself up as a street vendor in Rabat, where he expects to remain.
His story illustrates a trend that has gained increasing attention from Moroccan politicians, civil society and researchers.
Morocco has turned from a transit country into a host country for immigrants, according to the government's High Commission for Planning.
"The Moroccan authorities have switched from a security approach, which criminalised illegal immigration, to a discourse of integration," said Mehdi Alioua, former head of a group that helped migrants.
He said the new approach involves moving migrants from border regions to the country's big cities, taking them further from their ultimate goal - reaching Europe.
That has meant that many stay on in Morocco.
Rabat has become home to many sub-Saharan Africans who work at informal markets in the capital, while others, still hoping to make it to Europe, live in informal camps near bus stations and eke out a living by begging.
But their growing numbers have created tensions. In November, residents clashed with sub-Saharan youths living in a camp in Casablanca.
"You can't be welcomed with open arms everywhere you go," said Olivier Foutou, a 34-year-old Congolese.
But he called Morocco "the most welcoming country in Africa" and criticized fellow migrants "who think only of Europe and do not want to integrate".
Like many West Africans, he originally headed to Morocco for study, attracted by the quality of the education system and the possibility of scholarships.
Morocco arrests 11 suspects linked to Islamic State militants
He has stayed ever since, and sings in the choir at Rabat's cathedral, a meeting point for the city's small Catholic community.
Another choir member, Jean Baptiste Dago-Gnahou, fled war-ravaged Ivory Coast years ago and ended up in Rabat by "destiny".
In his 40s, he is teaching French and currently has no plans to return to his homeland.
Papa Demba Mbaye left his job as a teacher in Senegal seven years ago to "live the adventure in Morocco".
He was attracted by promises of work at a call centre, a growing sector in need of French-speakers.
He soon discovered that it was a "job with no future", and has since established himself as a French teacher.
He has written two books - "The life of a Senegalese in Morocco" and "Seven reasons why I love Morocco".
Keen to build links between sub-Saharan Africans and Moroccans, he also runs a theatre troupe on the outskirts of Rabat.
Despite Morocco's new migration policies and the kingdom's efforts to re-integrate with the African Union after decades outside the bloc, it is hard to gain permanent residency.
"I heard the king say on the radio that it would be a lot easier, but I have the impression that he was not heard," Mbaye said.
The authorities are currently processing some 25,000 residency applications. A similar "regularisation" campaign in 2014 saw around 23,000 people gain renewable residency.
It is hard to estimate how many African migrants are living in Morocco, especially as many are clandestine.
Official statistics show that around 35,000 had residency in 2014, according to the OCP Policy Center.
That is slightly above the number of European migrants who came for work or seeking a retirement home under the Moroccan sun.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ