UNITED NATIONS — With only the United States and Hungary voting no, the U.N. General Assembly overwhelmingly approved a non-binding compact Monday that provides more robust support for countries where most of the world’s more than 25 million refugees live.

The Global Compact on Refugees also sets out measures to share responsibility to help those who are forced to flee their countries because of conflict or persecution, and ease the burden on the small number of nations that host the majority of refugees.

U.N. refugee chief Filippo Grandi called the compact “historic” in a tweet, adding: “It is the biggest effort to broadly share refugee responsibilities that I have witnessed in 34 years of work with refugees.”

The vote in the 193-member assembly was 181-2, with the Dominican Republic, Eritrea and Libya abstaining.

U.N. Deputy Secretary-General Amina Mohammed said the Global Compact is very important because “in recent years, we have seen a contagion of closed borders, contrary to international refugee and human rights law.”

“Millions of refugees are facing years in exile, or risking their lives on dangerous journeys to an uncertain future,” she told an event marking the adoption. “Refugees are among those furthest behind. Persecuted, isolated and marginalized in their home countries, and too often in their countries of destination, they have struggled to be counted — and to count.”

U.N. High Commissioner for Refugees Grandi stressed that the compact is not just “a U.N. document that stays in a drawer.”

The rollout of the compact in 15 countries so far has mobilized $6.5 billion that wouldn’t have been accessible otherwise, he said. And it has already created “new momentum” and spurred “extraordinary projects,” including in Ethiopia, Kenya and Jordan, in such areas as energy, connectivity, communications and technology.

The agreement is separate from another non-binding compact to ensure safe, orderly and humane migration that was approved Dec. 10 by nearly 85 percent of the U.N. member states over fierce opposition from the United States.

The Global Compact for Migration is expected to be endorsed by the General Assembly on Wednesday.

The Global Compact on Refugees was adopted at a time when a record-high 68.5 million people have been forced to flee their homes. This includes 25.4 million who have crossed borders to become refugees, 40 million who are displaced within their home countries and 3.1 million who are seeking asylum.

According to the U.N. refugee agency, nine out of 10 refugees live in developing countries, where basic services like health or education are already strained.

Grandi stressed that it’s “a tough world” for refugees and migrants who are often stigmatized and politicized as threats.

“One message is that these people not only deserve compassion and protection and solidarity, but when given the opportunity, they can make a formidable contribution to society,” he said.

He called the refugee compact “a powerful expression of how we work together in today’s fragmented world” and stressed that “no country should be left alone to respond to a huge influx of refugees.”

The compact aims to provide more investment from governments and the private sector for infrastructure and services to benefit both refugees and host communities, including access to education.

It also aims to address the environmental impact of hosting refugees, promotes the use of alternative energy, and envisions more resettlement opportunities through family reunification, student scholarships, or humanitarian visas so that refugees can travel safely.

The compact builds on the 1951 Refugee Convention in addition to human rights and humanitarian law and makes way for a follow-up Global Refugee Forum every four years.

Despite the Trump administration’s opposition to the compact, Grandi said the United States has voiced support for refugees. And his office is “about to close the year with the highest-ever contribution from the U.S. to the UNHCR,” he said.

Hungarian Ambassador Katalin Annamaria Bogyay, whose government since 2015 has adopted increasingly strict anti-immigration policies, said existing international laws “adequately address refugee and asylum matters” and the compact was not needed.

“The government is also concerned that the differentiation between refugees and migrants as well as the voluntary nature of responsibility sharing is not adequately reflected in the document, she said.

This story has been corrected to show that there are 40 million internally displaced people and 3.1 million asylum seekers