Amnesty International says as many as 30,000 people in Nigeria's commercial capital of Lagos are homeless after their community was set ablaze and demolished this week.

It was not immediately clear how the fire began in the Otodo Gbame community, but residents told the London-based rights group that police officers blocked them from trying to put it out. They said police then returned with a demolition team.

Lagos officials have warned that makeshift waterfront settlements pose a "security threat" and must be razed, a process that could affect hundreds of thousands of people.

However, Amnesty International said a Lagos court on Monday granted an interim injunction against demolitions in communities, including Otodo Gbame.

Lagos officials were not reachable for comment. Amnesty International said those made homeless should be given alternative accommodation.