By Aaron Maasho and Khalid Abdelaziz
ADDIS ABABA/KHARTOUM (Reuters) - Sudanese President Omar al-Bashir will make his first visit to South Sudan since the country gained independence last July, officials said on Tuesday, as both sides seek to resolve a bitter and costly dispute over oil.
In another sign of a potential thaw in relations, the two countries also signed a deal ensuring free movement and residence of their nationals in one another's territory, two months after Khartoum threatened to treat South Sudanese as foreigners starting in April.
The two have been at loggerheads over issues including the position of their border, control of the disputed Abyei territory, and what transit fees South Sudan pays its northern neighbor to export oil from Port Sudan.
South Sudan shut down all its oil fields in January in protest at Khartoum's seizure of crude it said was to make up for unpaid fees. Juba depends on oil sales for 98 percent of state revenues, but says it will not restart production until a deal is reached. Khartoum is also heavily reliant on oil.
Bashir will travel to South Sudan's capital Juba within the next two weeks, Sudan Foreign Ministry spokesman El-Obeid Morawah said.
Sudan's president and his South Sudanese counterpart Salva Kiir are expected to sign the deals agreed in Addis Ababa on Tuesday, covering border disputes and the status of southerners living north of the border, he added.
More than 350,000 southerners have moved to South Sudan since October 2010 after decades living in the north, but some 700,000 southerners remain, the United Nations says.
Sudan's cabinet has warned that southerners would have to get residency or work permits by April 8 or risk being treated as foreigners, highlighting their lingering legal uncertainty.
"Time is important in this matter," said Morawah. "After April 8, southerners will become foreigners."
The International Organization for Migration has said the April deadline represents a massive logistical challenge to both governments and the international community.
A deal signed by Pagan Amum, head of South Sudan's negotiating team, and his Sudanese counterpart Idriss Abdel Gader said "nationals of each state shall enjoy in the other state ... freedom of residence, freedom of movement, freedom to undertake economic activity and freedom to acquire and dispose property" in accordance with each country's laws.
Both sides also agreed to set up a committee headed by their interior ministers to oversee measures that affect the status and treatment of their nationals.
A deal on oil could move closer with an agreement on the nationality question and also the thorny issue of border security. Both sides regularly accuse each other of backing rebels groups on their side of the boundary.
In February, the two agreed to demarcate the bulk of the border, aiming to finish their work within three months, although this would exclude five disputed areas.
Former South African President Thabo Mbeki, who is heading the African Union-sponsored talks between Khartoum and Juba, confirmed Bashir's visit.
(Reporting by Khalid Abdelaziz; Writing by Alexander Dziadosz; Editing by Ben Harding)