LAGOS (Reuters) - Amnesty International called on Nigeria to shelve plans to demolish more illegal settlements in the megacity Lagos as several hundreds of thousands of people could be made homeless, it said on Friday.

Some 30,000 residents of a waterside slum in the commercial capital, a city of 23 million, lost their traditional homes this week after state-ordered demolition and fighting between rival communities, residents said.

The London-based rights group said officials needed to provide alternative accommodation for residents and investigate why police and a Lagos agency had destroyed their housing despite a court ban until there had been a hearing.

“The authorities involved in this destruction are in flagrant violation of the law,” it said in a statement.

It called on Lagos state to stop any mass evictions after announcing plans last month to remove all illegal waterside communities until rules were in place to follow international law.

Police have denied claims by Lagos-based Justice and Empowerment Initiatives (JEI) that it had destroyed any buildings this week. It also denied it had a role in the reported drowning of four people which the rights group said had run into water after officers had opened fire.

Lagos officials could not be reached for comment.

The violence highlights the challenges of a rapidly rising population unable to provide enough jobs and housing for its 180 million people. Many end up trying to migrate to Europe by boat from lawless Libya.

Rights groups such as JEI say Lagos carries out demolitions to remove poor from attractive buildings sites -- Lekki island, the site of this week’s demolitions, is a prime site for real estate developers, who have been building luxury apartments and skyscrapers.

Officials have tried to attract more investment into Africa’s largest economy struggling with recession due to slump in oil prices.

The overcrowding in Lagos looks likely to continue. By 2050, Nigeria’s population is set to more than double to 400 million, making it the world’s third most populous nation after China and India, according to U.N. estimates.