Ministers are facing calls to publish legal advice given to the government on Israel’s war against Iran after reports emerged that the attorney general had warned that any UK involvement beyond defensive support would be illegal.Richard Hermer, the government’s most senior legal officer, is said to have raised concerns internally about the legality of joining a bombing campaign against Iran.Ed Davey, the Liberal Democrat leader, said the government should publish Hermer’s advice. “The last thing we need is for the UK to be dragged into another illegal war in the Middle East by the US,” he said.An official who had seen Hermer’s official legal advice told the Spectator, which first reported the story, that “the AG has concerns about the UK playing any role in this except for defending our allies.”It comes as the UK steps up efforts to persuade Donald Trump’s administration to refrain from joining Israel’s airstrikes in Iran. Keir Starmer said on Thursday there was a “real risk of escalation” in the Middle East.Asked about reports the US president had already approved a plan to attack Iran but had not yet decided whether to go ahead, the prime minister said: “The situation in relation to Israel-Iran is obviously fast-moving and in those circumstances, it’s really important to cling on to the key principles here.“Obviously all of us, UK included, are very concerned about the nuclear programme that Iran is developing, we’ve long been concerned about that. Also, [we] completely recognise Israel’s right to self-defence, but the principle is that we need to de-escalate this.“There’s a real risk of escalation here that will impact the region, possibly beyond the region, akin to Gaza, and obviously it’s already having an impact on the economy. So I’ve been absolutely clear we need to de-escalate this. Yes, the nuclear issue has to be dealt with, but it’s better dealt with by way of negotiations than by way of conflict.”David Lammy, the foreign secretary, is to meet Marco Rubio, the US secretary of state, in Washington DC on Thursday as the US weighs up its options. Whitehall sources said his message would be that the UK’s priority is diplomacy and de-escalation.So far the UK has not played any role, and it has not been involved in intercepting Iranian missiles directed at Israel.Starmer is considering whether to provide the US with military support if Trump decides to bomb Iran, and whether to approve the use of the Diego Garcia base in the Indian Ocean for the attack. Hermer’s advice could limit the degree of UK support for the US.There is no requirement for the government to hold a vote on military action, but in practice he would come under pressure to do so if the UK joined in airstrikes. There was no vote to give permission for UK forces to conduct airstrikes in Yemen, which are ongoing this year.No 10 refused to comment on Hermer’s legal advice about joining any US action in Iran.A spokesperson for the attorney general’s office said: “By longstanding convention, reflected in the ministerial code, [the question of] whether the law officers have been asked to provide legal advice and the content of any advice is not routinely disclosed. The convention provides the fullest guarantee that government business will be conducted at all times in light of thorough and candid legal advice.”Emily Thornberry, the Labour chair of the foreign affairs committee, said it was not “justifiable” for the UK to get involved in the conflict and should “keep away”.