U.N. Secretary-General Ban Ki-moon is urging legislators in the Dominican Republic to find a humanitarian solution to a fiercely debated court decision that could render thousands of people of Haitian descent stateless.

Ban spoke Wednesday to the Caribbean country's bicameral legislature a day after meeting with President Danilo Medina.

The Dominican Republic recently passed a law that would create a path to citizenship for the descendants of tens of thousands of migrants who came from neighboring Haiti. But human rights groups have said the law will likely exclude the majority of people born in the Dominican Republic to migrants, leaving them essentially stateless.

Ban asked that legislators keep working to protect the rights of all people.