David Cameron, Nick Clegg and Gordon Brown were accused by a judge of taking part in a "pre-election frenzy" which jeopardised expenses trials.
Mr Justice Saunders said the party leaders at the time had condemned three MPs for using legal aid to argue they were protected from prosecution.
The judge, who oversaw three expenses trials, said the criticism was "entirely without merit".
Four former MPs and two peers have now been convicted of expenses offences.
Mr Justice Saunders' comments were made during pre-trial hearings, but could not be reported at the time due to legal restrictions.
But Lord Hanningfield's conviction on Thursday was the last in a series of parliamentary expenses trials and the reporting restrictions have been lifted.
Mr Justice Saunders has presided over three trials - those of Lords Taylor and Hanningfield, and former MP Jim Devine, and has sentenced others who pleaded guilty before their trials began - Elliot Morley, David Chaytor and Eric Illsley.
During the 2010 general election campaign it was announced that three of the former Labour MPs, Chaytor, Morley and Devine, would receive legal aid as they launched their ultimately unsuccessful bid to have the criminal case against them thrown out.
They argued that MPs were protected from prosecution by the ancient right of parliamentary privilege - and Parliament, not the courts, should hear their case.
Then prime minister and Labour leader Gordon Brown said at the time they would probably have to pay the legal aid money back, Mr Cameron said it was a "complete outrage" while Mr Clegg said it was "outrageous" and "totally incomprehensible".
They also commented on the prospect of the MPs using parliamentary privilege as a defence - Mr Cameron said at the time he was "disgusted" by the idea while Mr Clegg said the public would be "appalled".
In pre-trial hearings last year, which can only now be reported, Mr Justice Saunders said the bid to use parliamentary privilege as a defence had been reported as "an attempt by guilty men to evade responsibility for what they had done" which was exacerbated when the legal aid was revealed.
He said public funding was granted on the same basis as it would have been to anyone else, and that the criticism was "entirely without merit".
"In an increasing pre-election frenzy, important political figures attempted to condemn the MPs who sought to rely on privilege with the assistance of legal aid in ever more extreme terms," he said.
"Those who joined in the condemnation were the present prime minister and deputy prime minister and the incumbent prime minister."
The politicians' lawyers had argued that "prejudicial publicity in the media" had jeopardised the trials.
The judge replied: "The adverse publicity that I have described has put at risk the fairness of the trial. The challenge of taking the appropriate steps to neutralise the adverse publicity by appropriate directions and guidance to the jury is considerable."
But the judge added that he was "confident" this could be achieved.
Following months of legal argument which ended up in the Supreme Court, the former MPs' efforts to have the cases against them thrown out on the grounds of parliamentary privilege was rejected in November 2010.