A deal to sell 316 Royal Bank of Scotland branches to Santander dramatically collapsed on Friday night in the latest embarrassing blow for the 81%-state owned bank.

The £1.65bn sale of the branches to the UK arm of the Spanish bank was announced more than two years ago but has been repeatedly delayed by the logistical challenges of integrating two separate bank systems.

The European Union had ordered RBS to offload the branches by the end of 2013 as a condition of the £45bn of state aid the UK government pumped into the bank to stave off its collapse at the height of the financial crisis.

Santander said the original deal had already been delayed by a year and it did not believe the transfer could be achieved by the companies' agreed final deadline of February 2013.

Stephen Hester, RBS chief executive, said the bank would "commence a new process of disposal" and a spokesman for the bank said it would hold discussions with the EU and the UK government about moving back the sale deadline. The debacle will increase the pressure on Hester, who was parachuted in to run RBS after its October 2008 bailout and has come under the spotlight for the slow turnaround of the bank.

Progress towards returning the bank to full private ownership has been much slower than the government had first hoped, with the bank reporting an increase in losses to £1.5bn from £794m in the first half of the year. The bank has cut more than 5,000 jobs over the past year.

RBS is also expected to be hit with a big fine for its role in the Libor rate-fixing scandal. Some experts believe it could be handed a bigger penalty than the £290m paid by Barclays.

Hester said it was disappointing that Santander had pulled the plug on the deal so close to completion, but said: "RBS's strong progress in our restructuring plans means we can continue to provide a stable home for this business and its customers pending a further resolution.

"While this is a profitable part of our business that we would rather not part with, RBS has worked hard to ensure it is substantially separate from our UK branch network and corporate business and largely ready to be taken on by a new owner."

RBS moved to reassure the branches' 1.8 million customers there would be no disruption to service and said they need not take any action.

Santander UK chief executive Ana Botin said: "Our guiding principle throughout this transaction has been a seamless journey for customers, which requires the business to be delivered to Santander UK by RBS in a steady state. We have concluded that, given delays, it is not possible to complete this within a reasonable time frame."

Steve Pateman, head of Santander UK's high street banking operation, said its executives "reluctantly and sadly" decided to pull out of deal late on Thursday night because consultants at Accenture predicted it would take until 2016 to complete the integration of the banks.

"We would have loved to own the RBS business but we won't any time soon, and the management decision was you have to go with plan B," he said.

Pateman said that plan involved spending the cash it will save from the deal on "deploying capital to grow our business organically".

Santander had already begun a branch closure programme in anticipation of the deal going ahead, with plans to close 56 branches to reduce overlap in its vast UK network following the takeovers of Abbey National, Alliance & Leicester and Bradford & Bingley.

The 316 branches to be sold comprise 311 RBS branches in England and Wales and five NatWest in Scotland.

Chancellor George Osborne is said to oppose the idea but the business secretary, Vince Cable, has campaigned in favour of nationalisation in order to support small business lending.

Cable wrote to David Cameron in March to urge him to use RBS as a vehicle for lending to small businesses.

In August, the Treasury said: "We are committed to repairing and returning RBS to full health so that it is able to support the UK economy in the future, and the current strategy is working to achieve that. The government's policy has always been to return RBS to the private sector, but only when it delivers value for money for the taxpayer."

The taxpayer is already sitting on a paper loss of more than £20bn from the government's intervention, with the shares close to half the value at which the government bought in.

RBS has sacked four individuals involved in the Libor scandal, which forced the boss of Barclays, Bob Diamond, out of his job.

The bank has also been forced to pay £1.3bn in relation to the mis-selling of payment protection insurance (PPI) and £125m to compensate customers who fell victim to a computer meltdown in June.

The collapse of the branches sale comes just days after RBS successfully floated its Direct Line insurance arm, which was also demanded by Brussels as a condition of the £45bn injection of taxpayer funds.

News of the dramatic collapse of the sale came just hours after RBS tried to raise hopes that it was on the verge of being able to leave the government's asset insurance programme next week