South Sudan’s deal to sell oil to Swiss-based trader Trafigura, made public recently, shows how new detente with Sudan may revive trade, but much can yet derail a pact meant to stifle hostility along their disputed border.

Landlocked South Sudan, independent since 2011 after decades of civil war, is to resume oil exports it shut off 14 months ago in a dispute over transit fees with Sudan’s government in Khartoum. The Trafigura deal, to pump crude to Sudan’s Red Sea terminal at Port Sudan, is a mark of its intent.

But among threats to the agreement the two Sudans signed this month to pull troops back from the frontier is a rebellion on the northern side that has long soured relations. Khartoum accuses South Sudan leaders in Juba of backing the revolt. They deny it and in turn accuse Sudan of backing rebels in the South.

And both sides also face pressure from local constituencies along the roughly 2,000-km border. For instance, South Sudanese villagers within a new demilitarised zone fear cattle-raiders and militias might exploit any security vacuum, possibly pressuring politicians in Juba to send troops back in.

“If anything happens, then I think we shall be coming back because the monitors and the international community are not around,” said Koang Chol, commander of the South’s withdrawing forces in the border town of Jau, as he stood on the abandoned trenches watching the troops pull back.

In the short term, the promise of petrodollars have lured the two sides — whose relationship is chiefly defined by mistrust, belligerence and brinkmanship — to make a deal that will ease crippling austerity measures and drastically reduce the incentive to return to war, analysts and diplomats say.

Landlocked South Sudan produced about 350,000 barrels of oil per day after independence, about three-quarters of Sudan’s pre-partition total, but shut down its entire industry in January last year during a row with Khartoum over fees. The loss of oil revenues, the dominant source of state income and the foreign currency both Sudans use to import food and fuel, stoked sharp depreciations of their currencies and roaring inflation that hit their conflict-weary populations. It also strained the patronage networks which ruling parties in both countries rely on to maintain their grip on power and which depended largely on oil money.

Many hoped mutual dependence on oil fees would keep the two sides from outright conflict. But after Juba shut down its output six months after secession, the two came close to all-out war over the Heglig oilfield on the border in April last year.

African Union-brokered talks appeared moribund but a breakthrough came this month when the two sides agreed to a timeframe to implement economic, security and territorial deals they had signed in September but never carried out. In the last few months spiraling inflation in Sudan and dwindling cash reserves in the South have made both governments nervous — and more receptive to cutting a deal with the other. But there are plenty of potential spoilers.

A few miles south of the abandoned garrison town of Jau, residents aired their misgivings that militias could exploit the absence of South Sudan’s army (SPLA) to raid villages: “My fear is that if they hear the SPLA has withdrawn from that area they will come and kill,” said Mialual Jau, a local chief. “We need a peacekeeping force that can protect civilians.” The two Sudans have agreed to maintain unarmed police in a Safe Demilitarised Border Zone and allow 1,126 United Nations peacekeepers to protect a joint team of 90 border monitors.

Diplomats, academics and analysts also say the rebellion in Sudan’s southern states bordering the South could yet unravel the deal with the South, although Khartoum has been more conciliatory toward the rebels since signing the pact with Juba.

Fighters once allied to South Sudan’s rebels during the civil war have been battling Sudan’s Army in the South Kordofan and Blue Nile states since the South finally broke away.