All deposits taken by landlords in relation to assured shorthold tenancies (AST) have to be covered by a Tenancy Deposit Protection scheme. This law was introduced to ensure that when a tenant pays a deposit, they are entitled to get all or part of it back.
A landlord will pay the deposit into a custodial scheme. At the end of the tenancy, if the landlord and tenant agree how the deposit should be allocated, they will tell the scheme, which will pay out the money as agreed