As the war in the Middle East enters its second month, choking the world's energy supply and sending oil prices soaring, China is trying to step in as a peacemaker.

It comes as President Donald Trump says US military action in Iran could end in 'two to three weeks', but there is no clear sense yet of how that will happen or what comes after.

China joins Pakistan, which has emerged as an unlikely mediator in the US-Israel war against Iran. Officials in Beijing and Islamabad have presented a five-point plan aimed at bringing about a ceasefire and reopening the vital Strait of Hormuz.

Pakistan, which has been a US ally in the past, seems to have won over Trump to mediate this conflict.

Beijing, however, is entering the fray as a rival to Washington, ahead of crucial trade talks between Chinese leader Xi Jinping and Trump next month.

China's backing on this is 'very important,' says Zhu Yongbiao, a Middle East expert and director of the Centre for Afghanistan Studies at Lanzhou University.

'Morally, politically and diplomatically, China is providing comprehensive support with the hope that Pakistan can play a more distinctive role.'

It is a turnaround for Beijing, whose official response to the war has so far been quite muted. So why is China stepping in now?

The peace plan was drafted after Pakistan's foreign minister flew to Beijing to ask for Chinese support for the country's efforts to negotiate an end to this conflict.

His efforts appear to have worked. China's Foreign Ministry said the two were making 'new efforts towards advocating for peace.' The joint statement agreed that dialogue and diplomacy were 'the only viable option to resolve conflicts' and called for waterways, including the blockaded strait, to be protected.

It's not just about oil, although that will be a concern. China, the biggest importer of crude oil in the world, has enough stockpiled to get it through the next few months.

Beijing will likely have decided to play the role of peacemaker because the war in Iran jeopardizes something Xi covets: stability. China needs a stable global economy as it is heavily reliant on selling goods around the world, especially as it tries to revive an ailing domestic economy.

'If the rest of the world begins to slow down economically because of an energy shock, that's going to be tough for China's factories and exporters,' says Matt Pottinger, Chairman of the Foundation for Defense of Democracy's China Program.

Concerns about rising oil prices affect the entire supply chain, from plastics used in toys to components for technology.

China's partnerships across the world come without military backing; instead, its economic ties give it leverage to project influence.

According to Zhu, 'China is cautious about being drawn into broader conflicts.' Its priority remains economic development.

China has previously acted as a mediator in Middle Eastern conflicts, though with mixed success. In 2023, it brokered a historic deal between Saudi Arabia and Iran, leading to a re-establishment of diplomatic relations after years of confrontation.

China’s latest mediation efforts in the Iran conflict reflect its ambition to solidify its role as a key player in the region.