Past problems with PPI mis-selling helped to push Royal Bank of Scotland to a £2bn loss for the first six months of the year, which included £1.3bn of litigation and conduct costs related to PPI.
There was also a £1.2bn special dividend payment to the government.
RBS set aside a further £450m to compensate customers mis-sold PPI, taking its total costs for this to almost £5bn.
Chief executive Ross McEwan said: "We're at the mid-way point in our five-year plan and we're making good progress. We are clearly in phase two of our strategy where our focus is on drawing a line under many of the legacy issues that have plagued this bank, and transforming the core business so we can deliver consistent, sustainable profits and results for our shareholders and do great things for our customers.
"We have changed as a bank over the last couple of years which means we are much stronger, more resilient and better positioned to deal with any uncertainty and economic slowdown that we may face."
Without the PPI problem, RBS made an operating loss before tax of £274m in the half year and said its personal and business, commercial and private and corporate and institutional banking franchises collectively made £2.0bn.
Laith Khalaf, senior analyst at Hargreaves Lansdown, said: "RBS has been pushed deep into the red by the costs of former misconduct, chief amongst them PPI compensation, which still casts a long shadow on the UK banking sector.
"The bank is also bracing itself for the huge costs stemming from a swathe of US litigation for mis-selling mortgage-backed securities in the run up to the financial crisis."