NAIROBI, Kenya — For the first time in months, after killing scores if not hundreds of each other's men, Sudan and South Sudan are back at the negotiating table, wrangled into peace talks by an increasingly worried international coalition, including the United States and China, that was terrified that the two countries were on the brink of a cataclysmic war.
It was less than two months ago that Sudan's president, Omar Hassan al-Bashir, ridiculed South Sudan's government in Juba as a measly "insect" that needed to be swatted away. Since then, the two sides have announced that they pulled out of Abyei, a disputed area. On Thursday, Barnaba Marial Benjamin, South Sudan's information minister, said the negotiations, taking place in Ethiopia, were "going well."

Guns flashing one day. Smiles the next. Sudan analysts say that is simply how it is going to be with these two feuding neighbors. Though Sudan and South Sudan may never descend to a full-fledged war, partly because of all the international attention, they will probably never achieve full-fledged peace either.

''I do not see things improving much and basically think that the current style of destructive but low-level violence will be the order of the day," said John O. Voll, a professor of Islamic history at Georgetown University and a longtime Sudan specialist.

Al-Bashir recently offered a similar assessment, saying, "If they want to change the regime in Khartoum, we will work to change the regime in Juba." He added, "And if they want to support our rebels, we will support theirs."

The tensions run deep. Guerrilla fighters in what is now South Sudan, which is mostly Christian and animist and culturally more akin to sub-Saharan Africa, fought for decades against the Arab-dominated leaders in Khartoum, Sudan's capital. Last July, South Sudan officially broke off from Sudan and became the world's newest country. People celebrated for days.

But the euphoria did not last. There were too many unresolved issues, and Sudan and South Sudan soon began squabbling bitterly over how to demarcate the border and share oil profits. (The conundrum of the two Sudans is that while most of the oil is in the south, the pipeline runs through the north.)

Complicating things even further was a fierce rebellion in the Nuba Mountains, which lie just across the border in Sudan. The Nuban fighters had been close allies of the southern rebels, and there was evidence that South Sudan's new government was covertly supplying the Nubans with money, tanks and militia fighters. At the same time, Khartoum seemed to be covertly arming ethnic militias in the south that had killed thousands in the past few years, making a mockery of the South Sudanese security forces.

In January, South Sudan cut off oil production, a measure aimed at Khartoum that also hurt at home. The southern government gets 98 percent of its revenue from oil sales and may soon run out of cash to pay its army, a situation everyone agrees is a time bomb. In April, vicious north-south fighting broke out along the border. Despite al-Bashir's boast that he had "fertilized the soil with their dead," South Sudan surprised many by seizing Heglig, one of the last oil fields Sudan still has. It seemed that all the internal stress and divisions in the north, including the continuing insurgency in the Darfur region, were finally catching up with Sudan and that its army was not what it once was.

Al-Bashir has many headaches, including soaring inflation, urban protests and his own status as an international pariah. Sudan has struggled under tough economic sanctions for years, and al-Bashir is wanted by the International Criminal Court on genocide charges for the massacres in Darfur. Analysts fear that a war would be just the lifeline he needs, and that his country would rally behind him. The same may be true for Salva Kiir, South Sudan's president, who also faces rising discontent and sharpening ethnic divisions in his new nation.

''Both sides have an interest in war," said Mariam al-Sadiq al-Mahdi, a leading opposition politician in Khartoum. "It's a way out for them, from internal problems they can't handle."

The last major conflict between the two sides, from the 1980s until the early 2000s, was a disaster, with more than 2 million people killed. Hundreds of thousands of starving refugees fled the fighting, including the so-called Lost Boys, orphaned children who trudged hundreds of miles across jungles and savannas, dodging bombers and lions.

The specter of a relapse into this carnage prompted the U.N. Security Council to intervene, passing a resolution on May 2 that threatened the two sides with sanctions if they did not stop fighting. The south immediately signaled it was ready to talk. Al-Bashir kept stalling, part of a strategy to allow the southern economy to become even more distressed and to bolster his own country's leverage to squeeze the south to pay higher oil transit fees.

''And it's true," said a U.N. official in Juba, speaking on background to frankly assess the state of affairs. "If a deal isn't worked out soon and those soldiers don't get paid, things could get ugly. The lights could literally go out in Juba."

The two sides are now discussing a seven-point security "road map" that requires pulling back from contested border areas, setting up a joint monitoring mechanism and ending covert support for proxy militias. The Security Council has given negotiators two more months to tackle the really delicate issues, like oil, but there is still a Persian Gulf-size gap between the two, with the north wanting more than $30 a barrel in transit fees and the south offering about a dollar.

Most analysts predict an oil compromise may be reached, but the more complicated territorial disputes may have to go to international arbitration, which could take years. While all this grinds on, analysts anticipate more breakdowns and attempts to patch things up, more violence followed by more hastily arranged cease-fires.

''While the tensions still exist and there's a lot of friction, both sides are saying, 'Look, we're committed to implementing the mandates spelled out by the African Union and the U.N. Security Council,'" said Princeton N. Lyman, the U.S. special envoy for Sudan, who has been attending the talks.

The most obvious problem is the lack of trust.

In the past year, the two sides have signed about five different protocols promising to demilitarize the border and cooperate on security issues and a variety of other matters. All have been summarily violated.

''The other side has been destroying South Sudan for 50 years," said Benjamin, the South's information minister. "Trust will take some time."