Boris Johnson would be committing the “gravest abuse of power and attack on UK constitutional principle in living memory” if he shuts down parliament to help force through a no-deal Brexit, according to legal advice obtained by Labour.

In a six-page document prepared for Jeremy Corbyn, the shadow attorney general, Shami Chakrabarti, laid out how any such move by the prime minister would be open to immediate legal challenge in the courts.

She said it could be subject to judicial review and the courts “might well even grant interim injunctive relief in order to allow both houses of parliament to continue to sit and discharge their primary and sovereign constitutional role in this current moment of national crisis”.

The advice from Chakrabarti, a barrister, was commissioned by Labour after leaked emails showed No 10 had sought the counsel of Geoffrey Cox, the attorney general, on whether a five-week prorogation from 9 September might be possible to avoid a confidence vote and help enable a no-deal Brexit.

The initial legal guidance for No 10 was that shutting parliament may be possible, unless action being taken in the courts by anti-Brexit campaigners succeeds in the meantime.

Johnson was pressed repeatedly on Monday on what he would do if MPs tried to thwart his Brexit policy – at a press conference at the close of the G7 summit in Biarritz. He declined to rule out temporarily shutting down parliament.

“I think that this [is] really a matter for parliamentarians to get right ourselves,” he said. “We asked the people to vote on whether they wanted to stay in or leave the EU; they voted to leave by a big majority.

Asked explicitly whether he would consider proroguing parliament, he said: “I rely on parliamentarians to do the right thing and honour the pledge that they made to the people of this country.”

Play Video 1:21 Boris Johnson insists backstop must be removed for Brexit deal – video

Parliament could be shut from 9 September until 14 October – two weeks before Johnson has promised to implement Brexit with or without a deal – under the plan being considered by No 10.

The official reason would be a break before a Queen’s speech setting out Johnson’s legislative programme, but it would have the effect of stopping MPs legislating against a no-deal Brexit or ousting the prime minister.

Chakrabarti’s legal advice, seen by the Guardian, argues any such move would be subject to legal challenge and the courts could intervene to make sure parliament sits while any dispute about prorogation is resolved.

She also cited the Gina Miller case brought against the government to ensure MPs had to give permission for triggering article 50 as an example of where the courts have found parliament to be sovereign in relation to the EU referendum result.

“The justices were clear that the referendum was in itself a creature of parliament and absent any specific legislative provision to the contrary, its result remains a political rather than a legally binding outcome and therefore subject to normal constitutional principles in the pursuit of its implementation,” she said.

Facebook Twitter Pinterest Gina Miller speaks outside the high court in 2016. Photograph: Dominic Lipinski/PA

In conclusion, Chakrabarti said the courts would entertain an urgent application for judicial review if Johnson were to ask the Queen for a prorogation in September, and an injunction could possibly be granted to allow parliament to sit pending resolution of the dispute.

“[The] Miller [case] itself contains the most recent and authoritative exposition of the constitutional principle of parliamentary sovereignty,” she said.

“Whilst it is alarming that lawyers for either Her Majesty’s government or opposition should have even to consider such a scenario in our cherished mature democracy, it is equally heartening that we may rely on our courts to protect it.

“I have no hesitation in advising that any such attempted administrative action by the government would constitute the gravest abuse of power and attack upon UK constitutional principle in living memory.”

With a week to go before parliament returns from the summer break, MPs fighting against a no-deal Brexit are considering whether to pass a law against this possibility or hold a vote of no confidence in his administration.

Corbyn is preparing to meet Westminster opposition leaders at his office in parliament on Tuesday, including Jo Swinson of the Liberal Democrats and Ian Blackford of the SNP, to discuss how they could work together to stop a no-deal Brexit on 31 October.

However, there are tactical divisions among the rebels. The Labour leader hopes to win a vote of no confidence and has offered to then lead a short-term caretaker government for the sole purpose of extending article 50 and calling a general election, in which Labour would argue for a referendum on a Brexit deal or remaining in the EU.

But Swinson has warned Corbyn would be unlikely to command a majority in the House of Commons, and pointed to alternative candidates, including the veteran Tory MP and remainer Ken Clarke.

No 10 remains confident Johnson can achieve Brexit on 31 October. Speaking in Biarritz, where the prime minister met the European council president, Donald Tusk, a senior UK government official said Johnson had delivered the message to EU leaders that Brexit cannot be stopped.

“The prime minister has been very clear to European leaders that he’s seen in the last week that the idea that Brexit can be stopped is incorrect and we are leaving on 31 October,” they said.

“He thinks that EU leaders should not be listening to the very wrong messages emerging from some parliamentarians who think that they will stop Brexit.

“The prime minister has been repeatedly clear that parliamentarians and politicians don’t get to choose which public votes they respect.”

Asked about prorogation, the official said: “No 10 commissions legal advice on a whole range of issues, but the PM is clear that he is not going to stop MPs debating Brexit.”

There has been little sign of progress on Brexit at the G7 summit, despite Johnson’s insistence he would meet the “blistering” challenge set by the German chancellor, Angela Merkel, of coming up with a new deal within 30 days.

On Sunday, he said it was “touch and go” as to whether an agreement could be reached in time. But Johnson also said he was “marginally more optimistic” about the prospects for a deal after the summit.

“Remember that all statistical estimates that I give about the chances of a deal – whether they are expressed in odds of millions to one, or getting closer, or hotter or colder, or whatever – they all depend exclusively on the willingness of our friends and partners to compromise on that crucial point and to get rid of the backstop and the current withdrawal agreement,” he said.

Johnson has avoided fresh bust-ups with EU leaders at the summit, and Downing Street was encouraged that Tusk agreed to meet the prime minister again on the margins of the UN general assembly in New York next month.