Public defender

A public defender is a lawyer appointed to represent people who otherwise cannot reasonably afford to hire a lawyer to defend themselves in a trial. Several countries, including the UK, Hungary and Singapore, and some states of Australia, provide people with public defenders. Brazil is the only country in which an office of government-paid lawyers with the specific purpose of providing legal assistance and representation to the destitute free of charge, is established in the constitution. The Sixth Amendment of the US Constitution requires the US government to provide free legal counsel to indigent defendants in criminal cases, and public defenders in the United States are full-time lawyers employed by the state or federal governments.
By country.
In civil law countries, following the model from the French Napoleonic Code of criminal procedure, the courts typically appoint private attorneys at the expense of the state.
Australia.
The Australian states of Victoria and New South Wales both have dedicated Public Defenders chambers. These chambers retain barristers who are employed by the state government to represent legally-aided clients who are charged with serious indictable offences. In New South Wales, Public Defenders only appear in criminal matters, both at trial and appellate level, while in Victoria, Public Defenders also undertake some family law and civil work.
The New South Wales Senior Public Defender is Belinda Rigg, Senior Counsel, who was the first female public defender in NSW upon her appointment in 2019. In Victoria the Chief Public Defender is Tim Marsh.
In Queensland, the Legal Aid Office (Queensland) was merged with the Public Defender's Office in 1991, in an expanded service providing clients to access family, civil and all criminal law services.
Brazil.
The Constitution of Brazil uniquely provides for a public defender's office ("Defensoria Pública") at both state and federal levels. Public defense is a right to poor people, who must declare, formally, that they cannot afford regular legal aid, to benefit from public defenders' services.
Public defenders, like prosecutors and judges, are admitted to their positions through civil service examination. The public defender's office assists the poor and lower middle-class in both civil and criminal matters, although the poorest states in the country are still struggling to set up a state public defenders office.
Public defense in Brazil dates back to 1897, when a decree mandated government-funded legal assistance in the state of Rio de Janeiro, then called Legal Assistance ("Assistência Jurídica"). The Constitution of 1937 extended "Assistência Jurídica" to the entire country, but without the same effectiveness that is derived from the current, 1988 Constitution.
Germany.
Germany provides legal representation, legal advice, and help in covering court costs in civil cases to those who cannot raise the necessary funds to hire an attorney, but only when there is a reasonable chance of success. In criminal cases where the defendant faces at least one year of imprisonment, the defendant has the right to legal counsel. Although there is a right to legal defense, there is no organized public defender system. Instead, any lawyer can be appointed to provide counsel to a specific defendant, and the defendant can select a specific lawyer. Questions of payment are deferred until the end of a trial, and the court will decide the cost of the case to the losing party. The defendant will not be charged for legal services if acquitted. If convicted, the defendant will be required to pay the lawyer's expenses unless the court finds that the defendant is indigent.
Hungary.
In Hungary, the police, the public prosecutor or the court (depending on what individual cases require) appoints a criminal defender at the state's cost to defend those who can not afford a chosen lawyer. The defence counsel's participation is required by the Criminal Procedure Act. Usually a private lawyer is appointed, one for each defendant, and conflict of interest between contradicting suspects is avoided, e.g. the same lawyer may not represent two accused whose evidence is mutually contradictory. If convicted, although in principle the defendant is liable for the fee, it is rarely pursued.
Singapore.
Legal assistance in Singapore is provided by the State and the Pro Bono Services Office of the Law Society.
The State provides legal assistance in criminal cases where the accused faces the death penalty. The government also provides legal representation and advice in civil cases such as for divorce, child custody, adoption, wrongful dismissal, letters of administration/probate, tenancy disputes, claims in contract and tort, through the Ministry of Law's Legal Aid Bureau (LAB). Assistance from the LAB is not free, and most clients are required to contribute towards the costs of the work done, but the amount a client is charged depends on a number of factors, among them the client's financial means.
The Pro Bono Services Office of the Law Society runs the Criminal Legal Aid Scheme, which provides criminal legal assistance to the poor and needy who are unable to afford a lawyer, and are facing charges in a Singapore court for non death-penalty offences under statutes covered by CLAS. 
United Kingdom.
There are a small number of Public Defender Service offices in England and Wales with lawyers employed directly by the Legal Aid Agency to provide advice in police stations and representation in magistrates and crown courts. The Public Defender Service has existed since 2001, a department of the Legal Aid Agency, an Executive Agency of the Ministry of Justice (UK). It has four offices across England and Wales. The majority of state funded criminal defence work, however, is provided by private duty solicitors contracted to the Legal Aid Agency and paid by the case under the legal aid scheme.
In Scotland a wider network of Public Defender Solicitor Office (PDSO) lawyers employed by the Scottish Legal Aid Board (SLAB) are available to represent those accused of crimes in addition to private lawyers (duty solicitors) paid under the legal aid scheme. The PDSO is a not-for-profit organisation funded through SLAB.
United States.
The 1963 US Supreme Court case "Gideon v. Wainwright" held that the Sixth Amendment's right to counsel provision requires the government to provide legal counsel to indigent defendants in criminal cases. Different jurisdictions, however, use different approaches in providing legal counsel for criminal defendants who can't afford private attorneys.
The term public defender in the United States is often used to describe a lawyer who is appointed by a court to represent a defendant who cannot afford to hire an attorney. More correctly, a public defender is a lawyer who works for a public defender's office, a government-funded agency that provides legal representation to indigent defendants. The court appoints the public defender's office to represent the defendant, and the office assigns a lawyer to the defendant's case. In the federal criminal court system and some states and counties, representation is through a publicly funded public defender office.
Other courts may appoint private lawyers who have agreed to represent indigent defendants, with appointment being either on a contractual basis, through which the lawyer accepts an agreed number of cases from the court for the term of the contract, or a case-by-case basis.