Britain is being forced to pour millions of pounds of new funds into the troubled F-35 stealth fighter programme being developed in America and considered a vital part of the UK’s future defences.

The F-35, being built by the US in partnership with countries including the UK, is the costliest weapon ever developed by the Pentagon. It is scheduled to go into service in the UK in 2018 and into full production in 2019, and is intended to be a cornerstone of UK defences for decades to come, flying off two new aircraft carriers.

But huge problems remain unresolved, in particular with the F-35’s advanced software, on which the whole project rests. The software is supposed to be the plane’s “brain”, running everything from ensuring a steady supply of parts to relaying masses of data to the pilot’s visor during combat.

President Donald Trump has twice tweeted about the F-35, saying the programme, whose cost has jumped from $233bn in 2001 to around $379bn now, was “out of control”. He has asked his defence secretary, General James Mattis, to conduct a review and has suggested looking at alternatives such as Boeing’s F-18 Super Hornet.

Any such shift would leave the UK, which has invested heavily in the F-35, seriously exposed, renewing questions about British reliance on the US. However, on Friday the president approved an $8bn order for the latest batch of 90 F-35s at an improved unit cost below $100m per jet, amid competing claims about how this saving had been achieved.

The F-35 was scheduled for completion in 2012 but finally began service with the US Marines and air force only last year, flying even though the software problems remain unresolved.

The fighter jets are scheduled to fly off the UK’s two new aircraft carriers, scheduled from around 2020, and by 2018 from RAF Marham in Norfolk, which is being upgraded for their arrival at a cost of £142m. Five have been sent to the UK so far. The British government has refused to publish an estimate of the overall cost of the 138 F-35s it is to buy, as well as its contribution to development costs, but the figure will run into the tens of billions.

In a damning assessment, Michael Gilmore, director of the US office of operational test and evaluation, who reports directly to Mattis, cited the software, the Autonomic Logistics Information System (Alis), as one of a number of problems likely to cause delays. The estimated cost of Alis is about $17bn.

In his annual report, published by Congress on 4 January, Gilmore predicted that the initial operational test and evaluation, scheduled for August 2017, would not begin until late 2018 at the earliest and more likely early 2019.

The SNP’s Douglas Chapman, who is a member of the UK defence committee, put down a parliamentary question to the Ministry of Defence asking if, in the light of Gilmore’s report, the UK would have to provide additional funding.

Defence minister Harriett Baldwin, in a reply on 26 January, said: “The Ministry of Defence has made a funding allocation for future development of Alis as part of the F-35 follow-on modernisation programme.”

She added: “I am withholding details of this funding as its disclosure would prejudice commercial interests.”

In a 2013 report, the Pentagon said any delays or problems with Alis could add $20bn to the F-35 programme cost. While the US would have to pick up most of that, the UK would have to pay a share.

Baldwin said that testing on Alis was expected to be completed by February 2017. But Gilmore’s report suggests that may be overly optimistic.

Asked about Gilmore’s report, the MoD said: “We are committed to the F-35 programme, which remains on time and within costs, and believe it offers the best capability for our armed forces.”

Chapman said he was not reassured by Baldwin’s response. “We would like far more transparency on big-ticket items such as the F-35,” he said. “The F-35, in terms of capability, is absolutely crucial to the defence of the UK but there are still significant questions. This does not fill people with confidence that everything is as tightly managed as it should be.”

He emphasised the vital part software plays in modern warfare, citing the malfunction in the Trident nuclear missile that resulted in a failed test-firing by HMS Vengeance off the coast of Florida last year.

Lockheed Martin, which is producing the F-35, referred questions about Alis to the Joint Program Office, which coordinates the US air force, navy and army and the 12 nations involved in the project, including the UK.

Joe DellaVedova, public affairs director of the JPO, said: “The F-35 programme continues to make steady progress, tracking to plan on our key schedule milestones and performance parameters, as well as improving overall affordability of the weapons system.”