The first minister has threatened legal action over the publication of a report into whether details about a cabinet reshuffle were leaked before the death of Carl Sargeant.
AMs are due to debate a Tory attempt to force the report’s publication.
Carwyn Jones asked the assembly’s Presiding Officer Elin Jones to call it off, threatening court proceedings.
But Ms Jones has rejected the first minister’s case, saying the debate on Wednesday will still go ahead.
Alyn and Deeside AM Mr Sargeant was found dead four days after being sacked as communities secretary in November following allegations about his conduct towards women.
A Welsh Government inquiry found “no evidence of prior unauthorised sharing of information” about his dismissal, according to a brief statement, despite claims it had been leaked.
Ministers have refused to publish the full findings of the inquiry, warning that doing so may reveal the identity of witnesses.
The Welsh Conservatives are seeking support for a vote under the terms of the Government of Wales Act to force publication of a redacted report – but the Welsh Government says the presiding officer acted “unlawfully” by accepting it.
In a letter to Ms Jones, the first minister wrote that calling off the debate would “bring the matter to an end without the need for court proceedings, which may otherwise need to be brought as a matter of urgency”.
Welsh Conservative leader Andrew RT Davies said it was a “direct challenge” to the legitimacy of the assembly.
Analysis by Vaughan Roderick, BBC Welsh affairs editor
If Carwyn Jones was hoping that the Easter break would relieve the pressure on him in the wake of Carl Sargeant’s death, he was given a rude awakening during today’s assembly proceedings.
With the government and the presiding officer at loggerheads over the assembly’s right to force the government to publish the controversial report, it is difficult to see how the issue can be resolved without having to go to court.
Even if the government’s legal arguments are correct, the case will only fuel accusations that they have something to hide.
The opposition parties know this, and it was clear during First Minister’s Questions that they smelled blood.
The Labour benches, on the other hand, were silent. There is no sign yet that Carwyn Jones has lost the support of his backbenchers, but it is also increasingly clear that their support is now conditional.
In his letter to the Presiding Officer Elin Jones, the first minister wrote: “We are concerned that the assembly has acted, and threatens to continue acting, unlawfully.”
If the Tories’ motion is not withdrawn, he adds: “I reserve the right to bring proceedings for judicial review.”
But in response the presiding officer said: “I have taken advice and carefully considered your arguments. Having done so, I am not persuaded of the case which you have advanced.
“As a result, the motion remains scheduled for debate.”
During Tuesday’s First Ministers Questions, Carwyn Jones told AMs he was considering legal action because of the “lack of clarity” with the current rules that could “potentially” make any government document releasable.
“If a whistle-blower came forward to a minister with a serious allegation on the basis of confidentiality and a document was created as a result of that, there is now no guarantee of confidentiality without further clarity,” he said.
Mr Jones denied that he wanted the leak inquiry debate cancelled, but he favoured it being postponed to allow a “protocol to be developed”.
Mr Davies, who wants a redacted version of the report published, accused the first minister of “trying to silence the assembly”.
Jeremy Miles, the Welsh Government’s counsel general and senior legal adviser, said the Welsh Government “never tried to stop the debate” from going ahead, but had sought a delay.
“The issue is about the interpretation of that bit of law. We would prefer to agree that interpretation with the assembly,” he said.
Neil Hamilton, UKIP Wales leader, called Mr Jones’s answers in First Minister’s Questions “tortuous” and “legalistic”, comparing them to the Watergate scandal that destroyed Richard Nixon’s presidency in America in the 1970’s.
“It wasn’t the break-in that actually brought down Richard Nixon but the attempted cover-up,” Mr Hamilton said.
“The president in that case said if the president does it, its not illegal.
“Does the first minister really want to go down in history as the tricky dicky of Welsh politics?”
“No one suggests that anyone is above the law,” said Mr Jones, dismissing Mr Hamilton as “the man that defends Enoch Powell”.
The Tories planned to use section 37 of the Government of Wales Act to compel the permanent secretary – the government’s top civil servant – to publish the report.
A Welsh Government spokesperson said: “This is much bigger than any single debate.
“The way section 37 is being interpreted by the presiding officer puts Welsh Government in the perverse position where we could be compelled to publish information without regard for any other laws or rights.
“We believe this is unlawful and given the significance of the issues surrounding section 37 we will seek proper determination by the courts.”
The government said there was a danger section 37 could be used to compel the release of sensitive information, including personal details or commercial confidential contracts without regard for data protection and other laws and regulations.
It said it had proposed a “sensible way forward” to the assembly commission – the body responsible for day-to-day business in the assembly – by suggesting lawyers for the two sides sat down to find a compromise.