Germany and China agreed to deepen bilateral cooperation in various fields amid US President Donald Trump's trade threats .

The two countries reached the consensus during talks between Chinese Premier Li Keqiang and German Chancellor Angela Merkel, who was on an official visit to China.

“China’s door is open. You can say it will open even wider,” Li further emphasized, adding that Beijing would protect the interests of German firms investing in China and adjust its rules if needed.

“If they come across any problems during their investment, especially when it comes to legal protections, I can clearly tell you that China is striding forward to being a country with rule of law,” he noted.

Chancellor Angela welcomed China's announcements that it would further open its financial sector to foreign participation and reduce Chinese joint venture requirements in sectors such as automobiles.

Germany and China should work on a "multilateral global system," Merkel said, stressing her attachment to the rules-based global framework that Trump is challenging.

Beijing and Berlin are concerned over Washington’s announcement about a national security investigation into car and truck imports that could potentially lead to tariffs.

During her visit, Merkel also said China and Germany, signatories of the 2015 Iran nuclear deal, are standing by the existing agreement after the US withdrawal from the deal.

Germany’s top executive faces a subtle balancing act on the state visit to demonstrate Chinese-German solidarity over trade and the Iran nuclear deal without damaging ties with long-term American ally.

Merkel further pointed out that if US sanctions force European companies to reduce commerce with Iran, “this creates the possibility for others to then get more into Iran.”

The Chinese premier also hinted that terminating the Iran nuclear deal would complicate negotiations with North Korea.