Under Robert Mugabe's decades-long rule over Zimbabwe, China grew into one of the African nation's biggest investors, trading partners and diplomatic allies.
Now, as Zimbabwe appears on the verge of its first transition of power since independence, Beijing is poised to be among the biggest winners.
A look at the increasingly close relationship between the two countries:
The back story
Mugabe began drawing closer to China's communist leaders under a "Look East" policy when Western countries imposed sanctions on Zimbabwe in 2001 over land seizures and human rights concerns. "We have turned East, where the sun rises, and given our backs to the West, where the sun sets," he famously said.
Mugabe has made frequent visits to Beijing, and sent his daughter Bona to university in Hong Kong. China, meanwhile, has vetoed United Nations Security Council sanctions on Zimbabwe.
Both sides portray the relationship as one between "all-weather friends.'' But "behind the scenes, things are a little bit different," said Derek Matyszak, a Harare-based senior researcher at the Institute for Security Studies.
"Relations between China and Mugabe have been quite fractious over the past year and a half, and the current situation is going to make things worse," he said.
China is unhappy about Mugabe's mismanagement of Zimbabwe's economy and is believed to favor as his successor, Emmerson Mnangagwa, who's seen as more of an "economic pragmatist," Matyszak said.
Mnangagwa was elected Sunday as the new leader of Zimbabwe's ruling party and is positioned to take over as the country's leader.
Zimbabwe's army commander, Gen. Constantino Chiwenga, visited Beijing in early November, around the same time Mnangagwa disappeared. The Chinese Foreign Ministry called it a ``normal military exchange,'' but the timing raised suspicions that it was anything but.
The countries' military links date back to the 1960s, when China helped train and supply guerrilla fighters from the Zanu's military wing in the fight for liberation. Mnangagwa, 75, was part of that effort _ he received military training in China in 1963, soon after he joined the fight against white minority rule in then-Rhodesia.
These days, China is a key supplier of military hardware to Zimbabwe. Major sales in recent years include a radar system, jet trainers and fighters, military vehicles and AK-47 assault rifles.
A Chinese company built the National Defense College in Harare, which opened in 2014 and was financed with an interest-free $98 million loan from China. The college, the biggest of its kind in the country, trains soldiers, intelligence operatives and police from Zimbabwe and other Southern African countries.
"China, of course, wants Zimbabwe to maintain a peaceful and stable political environment," said Wang Xinsong, a longtime observer of China-Zimbabwe relations at Beijing Normal University. "China's best interest lies in ensuring a peaceful and smooth transfer of power without major turmoil."
Once known as the "breadbasket of Africa," Zimbabwe's decline accelerated with the seizure of white-owned farms, sending the economy into a tailspin with skyrocketing inflation and widespread unemployment and poverty.
The lack of a clear succession plan for the 93-year-old Mugabe as well as an industrial nationalization plan have contributed to political uncertainty and spooked overseas investors. Zimbabwe's foreign direct investment fell for a second straight year in 2016, slumping by a quarter to $319 million, according to the latest U.N. World Investment Report.
Analysts believe one major reason Mnangagwa is popular with China is that he is seen as more investor-friendly than Mugabe.
"Of course, we must know that the investment can only go where it gets a return," Mnangagwa said in an interview with state-run China Central Television during a visit to Beijing in 2015. "So we must make sure we create an environment where investors are happy to put their money because they will have a return."
Chinese investors are likely holding off while they wait for a resolution, experts said.
"Chinese businessmen will become more prudent," said Zhang Chun, an expert in African studies at the Shanghai Institute of Foreign Studies. "For those that are prepared to make an investment there, they will delay their projects."
A big source of tension between Beijing and Harare was Mugabe's abrupt move to nationalize Zimbabwe's diamond mines.
Two Chinese companies, Anjin Investments and Jinan Mining, had partnered with the military and become big players in the Marange diamond field in Zimbabwe's east.
Mugabe, however, moved last year to revoke licenses from the Chinese and other foreign mining companies and consolidate all operations into a single company half-owned by Zimbabwe's government. He had apparently become alarmed that the government was missing out on revenue, blaming private companies after only $2 billion of an anticipated $15 billion had flown into government coffers since the field was discovered in 2006.
The Institute for Security Studies' Matyszak speculated that Mnangagwa could reverse that move, winning favor with both the military and China in the process.
Chinese tobacco company Tianze, meanwhile, has given interest-free loans and training to farmers, many of whom work on land seized from white farmers, to help beef up production and help fill cigarette demand back home.
The Beijing Automotive Group teamed up this year with two local partners in a joint venture, Beiqi Zimbabwe, selling Grand Tiger pickup trucks assembled from kits to compete with pricier imports.
China has helped build and pay for some big-budget infrastructure projects in Zimbabwe, including $46 million to fund the construction of the country's new parliament building in Harare last year.
Chinese state-owned Sinohydro is building $2 billion worth of expansion projects at Zimbabwe's two main, aging power stations to help deal with chronic electricity shortages. Chinese companies have also built a $150 million expansion of Victoria Falls International Airport and upgraded Zimbabwe's busiest highway.
Other deals announced during a visit by Chinese President Xi Jinping in 2015 included building a pharmaceutical warehouse, expanding the national fiber optic broadband network and supply wildlife monitoring gear.
China and Zimbabwe have been growing closer in other ways too, although results have been uneven.
In 2015, Zimbabwe sold China 35 elephants that were moved to wildlife parks in Shanghai, Beijing and Hanghzhou. But animal conservation groups raised concerns about the plan over fears that the animals would be split up from their herds and end up living under poor conditions.
China also has an image problem among many ordinary Zimbabweans, who see it mainly as a supplier of cheap but shoddy products like shoes and kettles that have been labeled with derogatory names for their famously short-lived lifespans.
The Mugabe family has been involved in a legal dispute over a multimillion-dollar Hong Kong property, and made headlines there in 2009 when Robert Mugabe's wife, Grace, allegedly assaulted a photographer during a shopping trip. She left the specially administered Chinese city without being charged.