Britain’s Lloyds Banking Group has agreed to the £1.7 billion takeover of its former unit TSB by Spanish bank Sabadell. Lloyds has been trying to sell the unit for more than five years. The unit has 632 branches. Sabadell will pay 340 pence a share. Lloyds said it has agreed to sell a 10% stake in TSB and to accept the bid for its remaining 40% stake. The offer is at a 31 per cent premium to the 260 pence price at which TSB floated on the stock market last year. Lloyds was ordered to sell the632 branches by the European Commission in 2009, as a direct result of its £20 billion taxpayer bailout. An attempt to sell them to the Cooperative Bank for £750 million collapsed in 2013 after the mutual lender found a £1.5 billion black hole in its balance sheet. Under EU rules, Lloyds had to be completely out of TSB by the end of this year. As part of the deal, Lloyds will give Sabadell £450 million to pay for transferring to the Catalan bank’s IT systems. In total, Lloyds will have spent £2.64 billion offloading TSB.