Former Anglo Irish Bank directors Pat Whelan and Willie McAteer were told by Judge Martin Nolan that it would be "incredibly unjust" to imprison them over the July 2008 illegal loan-for-shares scam at the now defunct bank, as they were led into "error and illegality" by Ireland's financial watchdog.

Whelan, 52, Anglo's former head of lending for Ireland, and McAteer, 63, the bank's former finance director, were found guilty earlier this month of giving loans to developers to buy shares in the bank.

But Judge Nolan said he could not give the two Dublin-born bankers a custodial sentence, as they were not motivated by "avarice or greed or the pursuit of profit" and because they believed the scheme was legal.

He added that the pair were motivated by "a genuine if misguided attempted to save the bank".

Both Whelan and McAteer – who had faced a maximum of five years behind bars – declined to comment after leaving Dublin Circuit Criminal Court, where they were told in an 18-minute ruling they would be assessed for community service.

The ruling included a stinging assessment of the financial regulator's failure to stop the deal to unravel an ill-fated $3.3 billion (€2.4billion) gamble on Anglo's shares – 28 percent of its total stock – by former billionaire and the tycoon Sean Quinn, who was once Ireland's richest man.

Judge Nolan said, "I find it incredible red lights did not go off some place in the regulator's office and the appropriate legal advice was not sought."

He added that the financial watchdog's failure to warn Anglo gave "a green light to lending."

The Irish Times reports that the Central Bank reacted to the judge's comments by stressing it had "substantially strengthened" Ireland's capacity in financial regulation and supervision over the past number of years and introduced "sweeping changes" in supervisory practices.

A spokeswoman for the financial institution said, "It is confident that the shortcomings identified by the court would not recur today."

With the conclusion of the trial, the government is now expected to focus its efforts on establishing a parliamentary inquiry into the banking collapse – which up to now has been put on hold by court proceedings.