South Sudan announced Friday that it would withdraw its forces from the contested oil town of Heglig, yielding to international pressure in a dispute that brought the newly independent nation closer to a full-blown war with its neighbor Sudan.

“An orderly withdrawal will commence immediately and shall be completed within three days,” South Sudan’s President Salva Kiir said in a statement.

But in Khartoum, Sudan’s capital, a senior military official declared a military victory, saying Sudanese forces had forced the southerners out of Heglig.

“Your victorious Armed Forces have managed to liberate Heglig city by force from the remnants of the south Sudan army and its mercenaries,” the minister for national defense, Abdel-Rahim Hussein, said in a statement carried by Sudan’s official news agency. “Your armed forces have entered at 2:20 p.m. and held Friday prayers inside the city.”

The different versions of events underscored the deep-rooted tensions between the two nations, which have played a high-stakes game for several months, determined to make the other blink and accede to its demands.

Kiir stressed that South Sudan still considers Heglig “an integral part” of South Sudan, and that its status should be determined by international arbitration. He referred to Heglig as “Panthou,” the name by which South Sudanese call the town.

The announcement by South Sudan came a day after the United States, the United Nations and other Western powers condemned its takeover of the Heglig oil field and urged it to withdraw.

The two sides fought Africa’s longest civil war before a 2005 peace deal led to South Sudan’s independence last year. But since then, tensions have steadily escalated over disputed border areas and oil revenue, leading to a series of deadly clashes that has displaced thousands of civilians.

This week, Sudanese President Hassan Omar al-Bashir threatened to reignite war with the south. He vowed to retake Heglig and deliver “a final lesson by force” to South Sudan, which he said was ruled by “insects.”

World leaders forcefully denounced South Sudan’s actions and urged both sides to negotiate a solution. U.N. Secretary General Ban Ki-moon described the invasion of Heglig as “an infringement on the sovereignty of Sudan and a clearly illegal act.” He also called on Sudan to stop bombarding South Sudanese territory and withdraw from other contested areas.

“The last thing the people of these two countries need is another war — a war that could claim countless lives, destroy hope and ruin the prospects of peace and stability and prosperity of all Sudanese people,” Ban said at a news conference Thursday.

The U.N. Security Council has been trying to muster a diplomatic response that could persuade the two sides to back down.

But on Friday, Khartoum was determined to torpedo South Sudan’s version of the events in Heglig, laying the groundwork for more tensions. At the United Nations, Sudan’s envoy told reporters that Sudanese troops had “chased out the aggressors from Heglig.”

“It was not a withdrawal, we ran them out,” Daffa-Alla Elhaq Ali Osman said. “We hope that they learned their lesson.”

South Sudan’s representative at the United Nations, Agnes Oswaha, denied Sudan’s claim that South Sudan had been forced from Heglig, and offered to invite journalists and other international observers into the town to confirm it.

She said Kiir has ordered South Sudanese forces to carry out an “orderly withdrawal” from the town within 72 hours. The government of South Sudan, she added, “took this decision because it does not wish to see a return of war.”

Col. Philip Aguer, South Sudan’s military spokesman, said Khartoum was in the middle of “a fake celebration” that was purely for propaganda purposes. South Sudanese troops managed to control Heglig for 10 days, he said, adding that Sudan had incurred many casualties.

“If we are asked to go back into the town, we can go back at any moment,” he said in a telephone interview. “We have not abandoned our claim over the area. What we have done is give a chance for the international community to try diplomacy to resolve the issues.”

Staff writer Colum Lynch at the United Nations contributed to this report.