The Chinese government is trying to make peace with Brazil’s leading presidential candidate, Jair Bolsonaro, whose China-bashing threatens to chill a profitable trading relationship that has benefited both countries.

Chinese diplomats based in Brasilia have met twice with top Bolsonaro advisers in recent weeks, according to participants in the meetings. Their aim is to highlight cooperation with Latin America’s largest country, whose grain and minerals have fuelled China’s rise while lifting millions of Brazilians out of poverty in the resulting commodities boom.

Bolsonaro has portrayed China, its largest trading partner, as a predator looking to dominate key sectors of its economy.

With its own economy slowing, China cannot afford to become embroiled in another costly trade war as it has with the United States.

Two-way trade between China and Brazil stood at US$75 billion last year, according to Brazilian government statistics. China has invested US$124 billion in the South American country since 2003, mostly in the oil, mining and energy sectors, and Beijing is eager to bankroll railway, port and other infrastructure projects to speed the movement of its Brazilian grain.

But the far-right Bolsonaro, much like US President Donald Trump, has criticised China repeatedly on the campaign trail, saying the Chinese should not be allowed to own Brazilian land or control key industries. An ardent nationalist, Bolsonaro is expected to win a landslide victory at the polls on Sunday.

“The Chinese are not buying in Brazil. They are buying Brazil,” he has warned repeatedly.

Companies in the crosshairs include China Molybdenum Co, which bought a US$1.7 billion niobium mine in 2016 that Bolsonaro said Brazil should develop itself.

Niobium is used as an additive to steel to make it stronger and lighter. It is used in cars, buildings, jet engines and a host of other applications. Brazil controls about 85 per cent of the world’s supply and Bolsonaro wants it to reap the benefits.

He is also on record opposing a planned privatisation of some assets of state-owned utility Centrais Eletricas Brasileiras SA (Eletrobras) on concerns that Chinese buyers would win the bid.

Officials at China Molybdenum declined requests for comment, but six senior executives at Chinese companies operating in Brazil told Reuters they were watching Bolsonaro’s remarks with varying degrees of concern.

“We are worrying a bit about some of his extreme views,” a Chinese infrastructure executive said. “He is on guard against China.”

Bolsonaro’s friendly leanings towards Taiwan are likewise vexing to Beijing, which considers the self-ruled island a renegade province. Bolsonaro in February became the first Brazilian presidential candidate to visit Taiwan since Brazil recognised Beijing as the sole Chinese government under the one-China policy in the 1970s.

The Chinese embassy in Brazil issued a letter condemning Bolsonaro’s Taiwan trip as an “affront to the sovereignty and territorial integrity of China”.

Bolsonaro’s combative stance is in stark contrast to the rest of Latin America, whose leaders have welcomed Chinese investment, loans and commodities purchases.

And it could eventually put him at odds with Brazil’s powerful farm and mining industries, for which China is an indispensable customer.

Shares of Brazilian miner Vale SA, for example, the world’s largest iron ore producer, hit an all-time high last month on strong Chinese demand for its high-quality ore.

Brazil’s farm sector, meanwhile, has reaped the benefit of China’s feud with Trump. Beijing has sharply reduced purchases of American soybeans, filling the gap with Brazilian crops. Brazilian exports of soy to China are up 22 per cent by value this year with about 80 per cent of its soy shipments now destined there.

The US-China trade war has given Brazil leverage for now but Jorge Arbache, former secretary for international affairs at the country’s planning ministry, said Brazil would do well not to overplay its hand.

Brazil “does not have the luxury of giving up its biggest trade and investment partner”, he said. “There’s not one economy in the world that can occupy the space China occupies.”

Chinese diplomats met with Bolsonaro’s top economic adviser Paulo Guedes in early September to discuss the importance of the bilateral relationship, Qu Yuhui, Chinese minister-counsellor at the embassy in Brasilia, said on Monday.

The Chinese team portrayed their nation as a partner that did not compete with Brazil economically, according to Qu, who attended the meeting, and another person familiar with the matter.

Guedes was offered a trip to China to strengthen his knowledge of the world’s second-largest economy, Qu said. He said Chinese diplomats made it clear they would like to meet Bolsonaro in person, although no meeting had been set.

“Regardless of right- or left-wing, we want to talk and advance the smooth development of China-Brazil relations, which we believe benefit both countries,” Qu said. “We have confidence that whoever is Brazil’s president will improve China-Brazil relations.”

Guedes did not respond to requests for comment.

Last week, Qu and another Chinese diplomat were spotted entering the offices of Congressman Onyx Lorenzoni, Bolsonaro’s campaign manager, proposed chief of staff and the organiser of the candidate’s Taiwan trip.

Qu declined to comment on the matter.

Lorenzoni said he met two Chinese diplomats and that there would be further talks after the election. China was a vital partner and the two countries would maintain good relations, he said.

If elected, Bolsonaro’s first major meeting with the Chinese would come early in his presidency. Brazil hosts the BRICS summit in 2019, an event that Chinese President Xi Jinping is likely to attend.

Bolsonaro is content with China purchasing commodities but the former army captain is wary of the Asian nation’s recent shopping spree in Brazil’s energy and infrastructure sectors.

China Three Gorges Corp paid 4.8 billion reais (US$1.3 billion) in 2016 to operate two of Brazil’s largest dams. Last year, State Grid Corp of China bought a controlling stake in Sao Paulo’s CPFL Energia and a subsidiary for 17.36 billion reais, while China’s HNA Airport Holding Group bought a controlling stake in Brazil’s second-busiest airport.

Brazil is now expected to put a number of government concessions and assets up for bid next year, including railways and state-held energy assets.

The outgoing administration of Brazilian President Michel Temer has attempted to privatise state-controlled energy company Eletrobras, a move which requires congressional approval.

Bolsonaro has said he is against selling Eletrobras generation assets because it would “leave Brazil in Chinese hands”.

The Chinese infrastructure executive said his company was worried that Bolsonaro might change the government auction rules to disadvantage Chinese bidders. He and other Chinese executives declined to be identified.

To date, Bolsonaro has been vague about how he would carry out actions to stop Chinese investment he sees as undesirable. Brazil has no equivalent of the US Committee on Foreign Investment, which reviews the national security implications of foreign investment in American companies.

Bolsonaro also needs to tread carefully with the huge agribusiness caucus that controls more than 40 per cent of seats in Brazil’s Congress.

The nation’s farmers are overwhelmingly supportive of Bolsonaro, but have made clear that maintaining good relations with China, their largest export customer, is paramount.

“The economy is much more important than propaganda to get votes,” said an executive at an agricultural company who declined to be identified. “You can’t change it that easily without severe repercussions.”