The President of South Sudan, Salva Kiir, has said he will not withdraw his troops from the Heglig oilfield on its disputed border with Sudan.
Speaking in parliament, Mr Kiir defied calls from the UN and African Union to pull out troops, after days of clashes.
He urged MPs to mobilise their supporters and prepare for war should Khartoum refuse to talks.
Meanwhile, South Sudan's army spokesman told the BBC Sudanese aircraft had bombed two towns, killing one person.
The fighting along the oil-rich border region is the worst since South Sudan gained independence last July.
Speaking in Geneva, UN Secretary General Ban Ki-moon said he was gravely concerned about the situation and urged both governments to "cease hostilities immediately" and hold a presidential summit to negotiate a solution.
He said: "War would only compound the already considerable sufferings of the people of Sudan and South Sudan.
"What is required is a political will and political leadership at the moment of need. This crisis requires the full and urgent attention of the international community."
On Wednesday, Sudan admitted that South Sudan had seized the town of Heglig, which is home to facilities that account for around half of Sudan's oil production.
The area is internationally recognised as Sudanese territory, but South Sudan disputes this.
South Sudan says it took Heglig in order to prevent the Sudanese army organising attacks from there.
In response, Sudan ordered a general military mobilisation and has vowed to act with "all means" against the attack. It has also pulled out of African Union-led negotiations with South Sudan.
In parliament in South Sudan's capital, Juba, on Thursday, Mr Kiir said he told Mr Ban: "I'm not under your command" and that although he did not want war with Khartoum, his country had to act in self-defence.
"I always say we will not take the people of South Sudan back to war, but if we are being aggressed [attacked] like this we will have to defend ourselves," he said.
"I am appealing to the citizens of the Republic of Sudan, especially the mothers, not to allow their children to be dragged into a meaningless war."
He said he had also warned Mr Ban that if Sudanese troops did not withdraw from Abyei, another disputed border area occupied by Sudan last May, "we are going to reconsider our position and we are going to head to Abyei."
The president, a former rebel commander, said that MPs, who are returning to their consistencies for a parliamentary recess, must mobilise all their "people" and tell them to forget "tribal conflicts" and unite to confront a more pressing danger.
"If they have guns, if the youth have the guns, let them keep these guns so that if we call them to come... [they can] confront what is coming from the north," he said.
"Anybody having a gun can come with his or her gun - the rest who do not have, we will come and provide them."
The BBC's Nyambura Wambugu in Juba said parliamentarians responded with cheers, the chanting of the ruling party slogans and war songs used during the two-decade civil war.
MPs do not necessarily want war but were happy that the president reflected the anger many in South Sudan feel about the months of Sudanese bombardments, she says.
In Khartoum, Sudan's leader Omar al-Bashir said war was "not in the interests of either South Sudan or Sudan".
"Our brothers in South Sudan have chosen the path of war, implementing plans dictated by foreign parties who supported them during the civil war," AFP news agency quotes him as saying.
Earlier in the day, Sudanese aircraft dropped five bombs on a bridge linking Bentiu and neighbouring Rubkotna, in Unity state, leaving at least one person dead and four injured, according to South Sudan officials.
"This is an indiscriminate bombing by Sudan's armed forces that has been conducted for almost one year now. They are bombing innocent civilians in northern parts of Unity state," army spokesman Col Philip Aguer told the BBC.
On Wednesday, the African Union said it was deeply alarmed by the clashes, and called on both sides to exercise the utmost restraint.
In a statement, the AU urged both countries to resolve this and all other outstanding issues "in a peaceful way in accordance with the overriding principle of establishing two viable states in Sudan and South Sudan".
Correspondents say Sudan, having lost most of its oil when the south seceded, will not tolerate losing any more.