Brussels will have to terminate the UK’s extended membership of the European Union on 1 July if elections for British MEPs have not been held, a leaked legal document reveals.

A three-month delay to Brexit beyond 29 March will not carry any conditions, but anything longer than that requires Britain to have taken part in European parliamentary elections, ambassadors have been told.

EU law does not stand in the way of multiple extensions to the UK’s membership if requested, the document says. But if elections had not been held in May, and the UK subsequently sought to stay on as a member state to avoid a no-deal Brexit, for example, the EU would be bound to reject a request, the document seen by the Guardian says.

“No extension should be granted beyond 1 July unless the European parliament elections are held at the mandatory date”, the legal opinion shared among ambassadors on Friday says.

The EU would “cease being able to operate in a secure legal context” should there be an extension beyond 1 July and British MEPs had not been elected, it warns.

“All acts of the union that would be adopted with the participation of an irregularly composed parliament would be open to legal challenge on this ground, which would put the security of legal relations in the union seriously at risk,” it says.

The 27 heads of state and government are to discuss and decide on the UK’s expected extension request at an EU summit next Thursday.

The Commons voted to seek an extension to 30 June, should Theresa May’s deal pass at the third time of asking. The prime minister had informed MPs that a lengthier extension would be required if the deal was voted down again as she sought to win round the rebels in her party.

The leak of the document will probably help May in her bid to play up the threat to Brexit that would come if the withdrawal agreement was rejected again.

The European council president, Donald Tusk, is lobbying member states to keep an open mind to such a prolonged delay to potentially allow the British government to rethink its strategy.

Some Brexiters have suggested that Britain could stay in the EU for 21 months to allow it to negotiate a full trade deal and avoid the problem of the Irish backstop, which would hold the UK in a customs union to avoid a hard border with Ireland.

But the document leaked to the Guardian suggests that the UK would have to hold elections for British MEPs by the time the European parliament sits for the first time on 2 July, despite claims to the contrary by some legal experts.

It also says that the UK will not be able to negotiate on the future relationship as a member state. The EU’s legal advice is that only treaty change could allow the UK to stay a member state without having held elections.

“Past experience shows that ratification by all member states could require at least two years,” the document says. “Therefore this possibility is not feasible in practice.”