Boris Johnson had secretly decided to suspend parliament nearly two weeks before asking the Queen, according to memos from Downing Street read out in court.

The court in Edinburgh heard the first memo was written by Nikki da Costa, the prime minister’s senior legal adviser, on 15 August and spelled out the plan to suspend parliament in the week beginning 9 September.

Her memo was circulated to a very small circle of key figures in Downing Street, including Mark Sedwill, the cabinet secretary, Ed Lister, the prime minister’s chief of staff, and Dominic Cummings, Johnson’s controversial chief adviser.

In public Johnson was then refusing to confirm he planned to do so but he ticked the secret memo and said “yes”, before sending Da Costa a handwritten note the following day, where he criticised the convention where MPs return for several weeks of Commons business after the summer holidays before breaking again for conference season.

He told Da Costa the “whole September session [at Westminster] is a rigmarole introduced to show the public that MPs are earning their crust. I don’t see anything especially shocking about this prorogation.”

This exchange of memos came 12 days before privy counsellors designated by Johnson met the Queen at Balmoral to ask her to prorogue parliament, on the grounds he wanted to present a significant new legislative programme on 14 October.

The documents, revealed in heavily redacted form for the first time at 10.55pm on Monday, were sent to the legal team acting for 75 MPs and peers who are challenging prorogation in the court of session in Edinburgh.

Aidan O’Neill QC, acting for the MPs and peers, said he only received an unredacted version of the documents on Tuesday morning.

He told Lord Doherty, the judge hearing the case, this proved Johnson was plotting to suspend parliament at the same time that his government’s lawyers had told the court in Edinburgh the question of prorogation was “hypothetical and academic” because no such decision had been taken.

The UK government had also refused to give the court any sworn affidavits setting out why prorogation was necessary and the prime minister had ignored O’Neill’s suggestion last week that he should provide one to the court.

Accusing Johnson of “incontinent mendacity”, O’Neill said the prime minister had shown an unwillingness to acknowledge and speak the truth. He said: “He has chosen not to be accountable to this court and seeks not to be accountable to parliament.”

David Johnston QC, acting for the UK government, apologised to the court for failing to produce the papers until the night before the hearing and admitted the government had breached the deadline for submitting them.

He said they were being produced in the spirit of transparency, to allow the court to understand the process behind the decision to seek prorogation.

Reading from a brief prepared by the government, Johnston insisted the legal action was academic because MPs were still being given time to sit and vote before exit day on 31 October, and set their own agenda. “We are not dealing with an executive which is out of control,” he said.

It was also well within the government’s and Queen’s constitutional rights to prorogue parliament, while a court did not have the competence or tools to judge on political decisions by a prime minister.

The Fixed-term Parliaments Act 2011, which requires a two-thirds majority in the Commons to stage an election within five years of a previous one, explicitly allowed a prime minister to prorogue parliament, he added.

This is “fast-moving and highly controversial situation”, Johnston said. “It is not a situation where the courts can properly impose additional legal standards on a political process.”

This case is the first of three legal challenges, including others to be heard in Belfast and London this week. Earlier Doherty had allowed the lord advocate, James Wolffe QC, Scotland’s chief law officer, to join with the O’Neill case.

Doherty is expected to give his judgment on Wednesday: if he rules that the UK government has behaved illegally then Johnson could be forced to immediately ask the Queen to suspend prorogation.

Doherty could also issue a temporary stay on that ruling because it will immediately be appealed by whichever side loses to the appeal court in Edinburgh this week and then the UK supreme court in London. He may also reject O’Neill’s case.