Loan losses , investment writedowns and legal costs led to the loss last year , the largest ever for a European bank .