Juba, Sudan - Long Sudan's most powerful friend, China is shifting ties just weeks ahead of a key secession vote, cozying up to the nation's separatist southern region in what appears to be a pragmatic concession to the impending partition of Africa's largest country.
China's move could help deal a final blow to any lingering hopes by Arab leaders in the north to hold the country together by force.
World leaders still fear that an expected pro-secession vote in Southern Sudan's January referendum will re-ignite a decades-long conflict between Sudan's ethnic African south and Arab-dominated government in the north, spilling refugees into neighboring lands and further destabilizing a region struggling to lift itself from decades of poverty and conflict.
The vote was called for in a U.S.-brokered 2005 peace deal. Yet for years, China - Sudan's chief economic player - kept aloof from the peace process. During Sudan's civil war, China provided key diplomatic refuge and military support for Sudanese President Omar al-Bashir, even as the U.S. imposed heavy sanctions on his regime.
The 2005 accord granted the former southern rebels their own regional government, but relations between China and Southern Sudan for years remained relatively stiff, despite the fact that most of China's oil interests are in southern territory. In 2008, China opened a consulate in Juba, the southern capital - still staffed by 5 people.
But in recent months, relations have warmed dramatically behind what one Western diplomat called a comprehensive and successful charm offensive towards Southern Sudan's leaders.
"China now realizes that secession is the most likely outcome to the referendum, and as the key economic player in Sudan, they want to hedge their bets and be on both sides," says Richard Downie, deputy director of the Africa program at the Center for Strategic and International Studies.
"China is hedging its bets, with a noticeable lean towards the south," said a Western diplomat in Sudan. The envoy could not be identified because he wasn't authorized to speak on the record.
The courtship began in August, after a visit to China by Anne Itto, deputy secretary general of the Sudan People's Liberation Movement, the former rebel group now governing Southern Sudan.
"I found them (the Chinese) scared to death," Itto says of her visit. "They had been told by Khartoum that if the south secedes, it would be chaos."
Itto's visit marked an apparent turning point. Since then, a wave of senior southern officials - more than 20, according to some counts - from the regional, state, and county levels have flown to Beijing in a flurry of visits.
In October, the Chinese Communist Party sent its first delegation to Juba. Then in November, it upgraded its Juba consul-general to ambassadorial level, and named its former envoy to Bahrain, Li Zhiguo to the post.
"Oil is of course our number one interest," said a Chinese official involved in Southern Sudan relations. "What we really want is stability."
"Chinese officials in Juba and Beijing have made clear that they are willing to recognize an independent Southern Sudan, and that they will follow the lead of the African Union," said the Western diplomat, who was not authorized to speak on the record.
The move is of more than just academic interest: it could represent a significant shift in the geopolitical scales just as Khartoum makes its final end-game calculations.
Many foreign governments feared that President Bashir would try to block the January referendum, attempt to take control of the oil fields, or simply refuse to recognize the result of the poll. The result of all three actions would likely be conflict.
If the Sudanese leader can no longer count on the Chinese to back him in clinging to the south, his options become far more limited.
"If I was Khartoum, I might be thinking the support of China in the U.N. Security Council is less certain now, although all we can really do is speculate at this point," said Downie.
China has already shown its willingness to buck its friendship with Bashir by deciding not to veto a request in 2008 by the International Criminal Court to investigate Bashir for war crimes in Darfur.
"Neutrality is what we are pushing for. That is good enough for us," said Barnaba Marial Benjamin, spokesman for the Southern Sudan government, who visited China in October. "This will be to our advantage."
The policy swing has been substantial, given the two sides' uneasy past. During Sudan's civil war, the SPLM declared the Chinese oil companies to be fair military targets for their role in providing income to the Sudanese government, and for their perceived exploitation of the south's natural resources.
China continues to benefit from its wartime investments. Last year, 60 percent of Sudan's exports -mostly oil - went to China. State-owned China National Petroleum Corp has poured billions into developing Sudan's oil fields and remains the industry's biggest player.
Even with the recent courtship, frictions remain.
China National Petroleum Corp. maintains its country headquarters in Khartoum and still has neither an office nor permanent staff in Juba, despite the fact that most of its oil interests lie south of the north-south border.
The company's relationship with southern communities on the ground is often strained.
In Southern Sudan's Melut County, a key oil-producing area, sprawling lakes of toxic waste water sit on the open ground, raising the ire of locals and state authorities.
"It has burned the fertile lands and caused the crops to not grow well. The cattle eat the grass, and it kills some," said Dinka sub-chief Chol Ayiik, who complained that miscarriages and child blindness are also on the rise among his people.
Simple mud huts often sit just yards away from an oil rig, and war-ravaged local communities still await basic services.
"We have 360 villages that have been demolished and (there's) still no compensation," said Akuoc Teng Diing, the Melut county commissioner.
Still, relations are advancing. CNPC has begun regularly communicating with senior southern officials.
In October, Benjamin and other senior officials visited CNPC offices in China, where he said they received a red carpet welcome. "Before, they would not listen. But now it seems they are listening," Benjamin said.
Ultimately, the Chinese shift is one of pure pragmatism - and business.
"China recognizes which way the wind is blowing," says Dan Large, research director at the School of Oriental and African Studies at the University of London. "They don't have any choice."
In exchange for the support for the referendum process, SPLM is promising to honor the previous oil contracts signed with Khartoum and to protect China's oil assets.
"In politics, friendship is not forever, and enmity is not forever," said the SPLM's Itto.
"We are not like the U.S. We don't say, 'You do that' or 'don't do that.' We can't. We think this is an internal affair," said a Chinese official involved in Southern Sudan relations. The official said he could not be named because he was not authorized to speak on the record.
After secession, both Sudan's north and south will need to cooperate for oil production to continue, as the export pipeline runs through the north.
"We are trying our best to convey to both sides that stability, and only stability, can bring development," said the Chinese official.
(Boswell is a special correspondent. His reporting is partially funded by a grant from the Humanity United foundation, a human rights group based in California)