Omar al-Bashir faces a presidential election in April
Sudan would accept the south's secession if southerners were to vote for independence in a referendum next year, President Omar al-Bashir said.
Speaking at a ceremony marking five years since the end of the north-south war, he said his National Congress Party did not want the south to secede.
But he said the party would be the first to welcome such a decision.
Analysts say Mr Bashir struck an unusually conciliatory tone in the speech, which has been well received.
In recent months tension has been rising between the two sides.
Southern politicians have accused Mr Bashir and his allies of wanting to fix the referendum to ensure a "no" vote - to try to keep the south's oil wealth to themselves.
Mr Bashir has denied the allegations.
Next year's referendum was part of the 2005 peace deal which brought to an end more than two decades of civil war.
The agreement also stipulated that a national election must be held. The vote is due in April.
In a televised address, Mr Bashir promised that the north would act as "good neighbours" to the south.
"The National Congress Party favours unity," he said.
"But if the result of the referendum is separation, then we in the NCP will be the first to take note of this decision and to support it."
The BBC's Peter Martell, in the south's capital Juba, says there is a generally positive feeling about Mr Bashir's comments - people in the crowd were cheering as he delivered his speech.
But he says plenty of people in the south remain sceptical and prefer to wait and see if he will honour his promises.
Mr Bashir is subject to an international arrest warrant for war crimes in the country's Darfur region.
And many in the south believe he and his allies have been arming rival ethnic groups in the south to destabilise the region.
The election in April will be the first multi-party national election in a generation.
Mr Bashir is standing for president, but the leader of Southern Sudan, Salva Kiir, is not.
Mr Kiir's SPLM party confirmed last week that he would seek re-election to the post of Southern Sudan president rather than national leader.
The SPLM is instead fielding another candidate for the post of national president, which correspondents says shows that the party's priority is independence for the south.
During the celebrations to mark the end of the war, Mr Kiir made a plea for southerners to accept the result of the referendum whatever it may be.
"The north and south will continue to be economically and politically connected whatever the choice of the people of Southern Sudan," he said.
He stressed that oil, which makes up 90% of the south's wealth, would still be pumped through the north for processing until the south could construct its own facilities.
After years of conflict, Southern Sudan is one of the poorest areas of the world.
Last year, some 2,000 people died in conflicts in the region, which the SPLM say are being stirred up by allies of Mr Bashir in order to destabilise the region ahead of the elections.
Mr Bashir's National Congress Party has denied the charges.