Scottish government lawyers had “reservations” about its court battle with Alex Salmond more than two months before it conceded the case.
Mr Salmond had said the government was told in October 2018 that it was likely to lose the case.
The government only admitted the following January that its investigation into complaints against Mr Salmond had been unlawful.
Deputy First Minister John Swinney has now admitted that concerns were raised.
But he insisted there were “good public policy arguments and reasonable grounds” to continue contesting the case.
The government ultimately had to pay Mr Salmond’s legal fees of more than £500,000 on top of its own costs after its admitting its investigation had been unlawful.
There have been claims that continuing to contest the case after being given legal advice that it was unlikely to succeed would be a waste of public money and potentially a breach of the ministerial code.
The government is to release key papers – including external legal advice – to the Holyrood inquiry committee that is investigating the saga, with Mr Swinney saying the unusual move was to “counter false claims being made by some”.
The Scottish Conservatives said they would press ahead with a vote of no confidence in the deputy first minister, saying he was “releasing only the evidence he wants us to see”.
There has been a long-running row over the legal advice given to the Scottish government after Mr Salmond launched judicial review proceedings in 2018 over the way internal harassment complaints against him had been investigated.
The government admitted in January 2019 that its approach had been unlawful, because its investigating officer had had prior contact with the two complainers – in breach of a newly-designed procedure.
Mr Salmond had claimed that ministers were given legal advice on 31 October 2018 which “indicated that on the balance of probability, the government was going to lose the judicial review”.
He said that “if the case was continued in the knowledge of the first minister against that legal advice, that would be a breach of the ministerial code”.
The Holyrood committee investigating the government’s botched handling of the complaints has been pushing to see the full legal advice for some time, and MSPs have twice voted to say it should be handed over.
On Monday, Mr Swinney confirmed that key papers would be handed over – after it became clear that all opposition parties were set to back a motion of no confidence in his position.
He confirmed that concerns had been raised about the issue which ultimately collapsed the government’s case, but insisted there were other reasons to fight on.
The committee has previously been shown a memo summarising legal advice, which said external counsel had threatened to resign on 28 December 2018 and that Permanent Secretary Leslie Evans was told the next day that “the only sensible and defensible position is to concede the petition”.
In a letter to the committee published on Tuesday, Mr Swinney said: “The documents confirm that, whilst reservations were raised about the judicial review following the identification of the issue of prior contact with the complainers in late October, there were good public policy arguments and reasonable grounds for the government to continue to defend the judicial review and to seek a determination from the court on the matters raised, until the events of late December 2018.”
Mr Swinney also told the committee that the documents being released should be with them by Tuesday afternoon.
However the Scottish Conservatives said they would not be withdrawing their motion of no confidence until the committee was satisfied that all of the advice had been handed over.
Leader Douglas Ross said: “Recklessly continuing with the judicial review when it was doomed would clearly be a breach of the ministerial code. The public deserve to know exactly what mistakes were made.
“John Swinney is not getting away with releasing only the evidence he wants us to see. We will press ahead with the vote of no confidence until all the legal advice is published.”
In his letter, the deputy first minister said that the release of the material meant “the Scottish government will have responded to all of the committee’s requests for specific documents within our legal and other obligations”.
He said he hoped that it would “assist the committee in fulfilling its remit and address some of the allegations that have been raised, without evidence, in the past few days”.
The committee is taking evidence from Lord Advocate James Wolffe – the government’s top legal adviser – on Tuesday morning, with First Minister Nicola Sturgeon due to face the inquiry on Wednesday.