(CNN) -- Thousands of South Sudanese stranded for months at a river port in neighboring Sudan will be airlifted to their homeland under a new agreement, the International Organization for Migration said.
Between 12,000 and 15,000 South Sudanese have been stuck at the Kosti way station and are running out of means of support.
Sudan had ordered them to leave the area in White Nile state within a week, but canceled the deadline and will assist them with emergency travel documentation and arrange to move their luggage, the migration agency said Friday.
The migration agency said it is developing a plan to move them that will include charter flights to the South Suan capital of Juba.
"This is the best solution for all concerned and we are grateful to the governments of Sudan and South Sudan for their cooperation and support in ensuring that the South Sudanese in Kosti can now move to South Sudan in safety and dignity," said Jill Helke, the Sudan chief of mission for the the migration agency.
The concern for their plight came amid reports of military attacks along Sudan's hotly contested border with South Sudan.
Those stranded have waited with their "entire house holdings" for transport to South Sudan, and lack basic services including food and water, the United Nations said.
"All are dependent on collaboration between Sudan and South Sudan and assistance from the international community for proper transportation facilities, food, water, health care and other essential services and most do not have the means to transport themselves to South Sudan," the United Nations said in a statement.
South Sudan split from Sudan last year as part of a 2005 peace deal that ended decades of war in Africa's largest nation. The war left 2 million people dead and ended with the peace agreement that included an independence referendum for the south.
But clashes around oil-rich border areas have continued despite the split, sparking fears the two sides could return to an all-out war.
Tensions between the two peaked last month when South Sudan seized the oil-producing region of Heglig, which fuels the economies of both nations, from its northern neighbor. Heglig oil facilities account for about half of Sudan's production of 115,000 barrels a day.
South Sudanese forces withdrew days later after Sudan lodged protests with the United Nations and African Union, but South Sudan said it continued to come under aerial and ground attack.
Significant issues between the countries remain unresolved, however, including status of their citizens, division of national debt, disputed border areas and sharing of oil wealth.