NAIROBI - Ethiopia passed a law Thursday giving almost 1 million refugees the right to work and live outside of camps, in a move praised for providing them with more dignity and reducing reliance on foreign aid.

Home to Africa's second largest refugee population after Uganda, Ethiopia hosts more than 900,000 people who have fled conflict, drought and persecution in neighboring countries such as South Sudan, Sudan, Somalia and Eritrea.

The refugees — many of whom sought refuge decades ago and have children born in Ethiopia — are largely confined to one of about 20 camps across country. Most are not permitted to work.

"We are happy to inform that the new refugee proclamation has been enacted by the House of Peoples' Representatives of the Federal Democratic Republic of Ethiopia," Ethiopia's Administration for Refugee and Returnee Affairs (ARRA) said.

U.S. Ambassador to the United Nations Nikki Haley FILE - South Sudanese refugees are seen at the Nguenyyiel refugee camp in Ethiopia, Oct. 24, 2017. FILE - South Sudanese refugees are seen at the Nguenyyiel refugee camp in Ethiopia, Oct. 24, 2017.

"It is strongly believed that the new law will enhance the lives of refugees and host communities," added the statement posted on ARRA's Facebook page.

With record numbers of people being forced to flee their homes, most of the world's 25 million refugees are hosted by developing countries in camps where funding shortages often leave them short of basics like food and education.

The new law is in line with Ethiopia's commitment toward the United Nations Global Compact on Refugees, adopted by world leaders in December to increase refugees' self-reliance and ease the pressure on host nations.

The law allows refugees to move out of the camps, attend regular schools and to travel and work across the country.

Refugees can formally register births, marriages and deaths, and will have access financial services such as bank accounts.

The head of the Ethiopian Investment Commission Fitsum Arega said the new legislation was part of the country's "Jobs Compact" — a $500 million program which aims to create 100,000 jobs — 30 percent of which will be allocated to refugees.

"This helps refugees & supports #Ethiopia's industrialization," said Arega on Twitter.

'Right thing to do'

Aid workers said Ethiopia served as an example in a world where, in some regions, the rights and freedoms of refugees and migrants are being eroded.

"As some Western countries have adopted xenophobic policies while turning away refugees, we are pleased that Ethiopia has passed this revised refugee law," said Stine Paus, Country Director for the Norwegian Refugee Council in Ethiopia.

It will allow more refugees to live in urban areas, secure limited work permits, give some access to farmland and increase education enrolment for refugee children, she said.

"The law will help refugees feel included and that they can contribute to society," said Dana Hughes, spokeswoman for the United Nations refugee agency in East Africa.

"But we must remember that access to education and employment doesn't just benefit refugees, it also contributes to the economy and benefits local communities. Such legislation isn't just the right thing to do, it's the smart thing to do."