According to AI
In the UK, the government pays for the lawyers representing individuals in immigration and human rights cases, including those deemed "illegal immigrants," through a legal aid funding system. Individuals who qualify for this funding do not pay for their legal costs, and the lawyers are paid through contracts awarded by the government to provide these services.
The overall cost of legal aid in these cases is covered by taxpayers.
Cases where legal aid has been used include the successful defence of individuals against deportation orders, such as the case of Abu Qatada, where the government paid for lawyers to fight his deportation