The BBC's Will Ross in Juba says the new country's problems have been put aside for the night amid an air of great jubilation.

People were in the streets, cheering, waving South Sudan flags, banging drums and chanting the name of President Salva Kiir Mayardit, he adds.

A formal independence ceremony is due to be held later on Saturday.

The Speaker of the South Sudan Legislative Assembly, James Wani Igga, is expected to read out the Proclamation of the Independence of South Sudan at 1145 (0845 GMT). Minutes later Sudan's national flag will be lowered and the new flag of South Sudan will be raised.

In addition to Mr Bashir and Mr Ban, attendees will include former US Secretary of State Colin Powell, the US permanent representative to the UN, Susan Rice, and the head of the US military's Africa Command, Gen Carter Ham.

Under the Comprehensive Peace Agreement, a referendum was held on independence, which was favoured by more than 99% of voters.

The new country is rich in oil, but one of the least developed countries in the world, where one in seven children dies before the age of five.

Unresolved disputes between the north and south, particularly over the new border, have also raised the possibility of renewed conflict.

On Friday, Sudan's Minister of Presidential Affairs, Bakri Hassan Saleh, announced that it recognised "the Republic of South Sudan as an independent state, according to the borders existing on 1 January 1956", when Sudan gained independence from Britain.

'Southern brothers'

President Bashir, who agreed the 2005 peace deal with the Sudan People's Liberation Army (SPLA), stressed his country's "readiness to work with our southern brothers and help them set up their state so that, God willing, this state will be stable and develop".

"The co-operation between us will be excellent, particularly when it comes to marking and preserving the border so there is a movement of citizens and goods via this border," he told journalists in Khartoum.

Fears of fresh conflict resurfaced after recent fighting in two border areas, Abyei and South Kordofan, which forced some 170,000 people from their homes.

But separate deals - and the withdrawal of rival forces from the border - have calmed tensions.

The UN Security Council has passed a resolution approving a new 7,000-strong peacekeeping force for South Sudan - but this is basically a rebranding of the force which was already in Sudan, mostly in the south.

Khartoum has said its mandate would not be renewed, leading the US to argue that the 1,000 UN troops should be allowed to remain in South Kordofan. The 1,000 troops in the disputed town of Abyei are to be replaced by 4,200 Ethiopian soldiers.

Our correspondent says keeping both the north and the south stable long after the celebratory parties have ended will be a mighty challenge.

Media playback is unsupported on your device

Media captionAll you need to know about South Sudan's independence

The two sides must still decide on issues such as drawing up the new border and how to divide Sudan's debts and oil wealth.

Analysts say the priority for Khartoum will be to negotiate a favourable deal on oil revenue, as most oilfields lie in the south. At present, the revenues are being shared equally.

Khartoum has some leverage, as most of the oil pipelines flow north to Port Sudan on the Red Sea.

Citizenship is also a key issue which has not yet been decided.

A new law passed by the National Assembly in Khartoum has withdrawn Sudanese citizenship from all southerners.

The UN refugee agency (UNCHR), has urged both governments to prevent statelessness.

Both Sudan and the South are reliant on their oil revenues, which account for 98% of South Sudan's budget. But the two countries cannot agree how to divide the oil wealth of the former united state. Some 75% of the oil lies in the South but all the pipelines run north. It is feared that disputes over oil could lead the two neighbours to return to war.

Although they were united for many years, the two Sudans were always very different. The great divide is visible even from space, as this Nasa satellite image shows. The northern states are a blanket of desert, broken only by the fertile Nile corridor. South Sudan is covered by green swathes of grassland, swamps and tropical forest.

Sudan's arid north is mainly home to Arabic-speaking Muslims. But in South Sudan there is no dominant culture. The Dinkas and the Nuers are the largest of more than 200 ethnic groups, each with its own languages and traditional beliefs, alongside Christianity and Islam.

The health inequalities in Sudan are illustrated by infant mortality rates. In South Sudan, one in 10 children die before their first birthday. Whereas in the more developed northern states, such as Gezira and White Nile, half of those children would be expected to survive.

The gulf in water resources between north and south is stark. In Khartoum, River Nile, and Gezira states, two-thirds of people have access to piped drinking water and pit latrines. In the south, boreholes and unprotected wells are the main drinking sources. More than 80% of southerners have no toilet facilities whatsoever.

Throughout the two Sudans, access to primary school education is strongly linked to household earnings. In the poorest parts of the south, less than 1% of children finish primary school. Whereas in the wealthier north, up to 50% of children complete primary level education.

Conflict and poverty are the main causes of food insecurity in both countries. In Sudan, many of the residents of war-affected Darfur and the border states of Blue Nile and South Kordofan, depend on food aid. The UN said about 2.8m people in South Sudan would require food aid in 2013. The northern states tend to be wealthier, more urbanised and less reliant on agriculture.