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 with the aim of bringing about a ceasefire and re-opening 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, and ahead of a crucial trade talks between Xi Jinping and Donald 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 also 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 it called for waterways, including the blockaded strait, to be protected.

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

There are already fears that China's industrial heartland, which serves as the factory of the world, will be impacted in the long term if this crisis continues.

Paying a higher price for oil affects the whole supply chain, from the plastics needed to make toys and games, to the raw materials for modern synthetic fabrics, to the hundreds of components that go into phones, electric cars and semiconductors.

China's partnerships across the world come with no security guarantees or military backing. For Beijing, its economy comes first - and it is this economic interdependence with countries across the region that gives it leverage and helps it project some influence.

But this approach has its limits. China doesn't have the military capabilities in the region to step in even if it wished to do so. The US has bases in each of the Gulf states. China's closest base is in Djibouti in East Africa and was only established in 2017.

As for this latest peace plan, both the US and Iran have yet to respond, but pushing forward this initiative allows Xi to play the role of neutral broker and peacemaker - and once again stand in contrast to the leader of the other major superpower, the US.