The primary difference between court-ordered legal aid and government-funded legal aid is that certain individuals may not qualify for the government-funded legal aid; nevertheless, their personal circumstances, the complexity of the case, the consequences of the case, may be such that the courts, upon application of the individual, are of the opinion that without the assistance of legal counsel the person would not be able to have full answer in defence or a fair trial.
In these situations, the court cannot order the government legal aid system to pay. But judges can say to the prosecutor, the government, that they have to ensure that the rights of the individual to a fair trial are respected under the Constitution by giving the individual access to legal funds. Generally, this has meant that attorneys general, federal or provincial, have had to fund at least a portion of the legal costs directly out of their budget for legal aid. So it doesn't come out of the legal aid program; it comes out of the resources of the attorney general.