The UK’s set to agree a £2bn loan guarantee for the world’s leading oil producer in one of the largest-ever initial public offerings.

The UK Treasury had said it carried out due diligence and was “finalising” the loan for Saudi Aramco, officially the Saudi Arabian Oil Company, through its UK Export Finance (UKEF) group.

It would be one of the UKEF’s biggest loans – the largest being a 2016 $2.1bn guarantee to Oman to support the purchase of BAE Systems military hardware.

A spokesperson told City AM: “UK Export Finance works to increase UK exports by providing finance to overseas buyers of our goods and services. As part of this, we will be providing Saudi Aramco with support in the form of credit guarantees to procure from the UK.”

But the timing of the loan has been questioned as both the UK and the US have been battling to win the international offering of the company.

President Donald Trump made a public plea for the listing earlier this month. He said on Twitter earlier this month that he would “very much appreciate” if Saudi Arabia chose the New York Stock Exchange. Prime minister, Theresa May, also travelled to Riyadh with London Stock Exchange chief executive Xavier Rolet earlier this year.

Saudi Arabia has begun to explore alternatives to an overseas listing, including looking to a private placements and domestic listing instead.

The loan guarantee has been criticised by former UK Treasury permanent secretary Sir Nick Macpherson as a “further lurch” in Britain’s “descent to mercantilism”.

But the Treasury said the deal was not linked to any attempt to win the international listing and said it was “completely separate to that”.  Saudi Arabia has undertaken various new reforms under its Vision 2030, which the IMF said was “beginning to bear fruit”.

It has also launched an anti-corruption initiative and dozens of royal figures, ministers and businessmen have been arrested.