BP will emerge from the Gulf of Mexico oil spill crisis a smaller and wiser company, according to the man who is due to take over the reins.
Bob Dudley, currently in charge of BP's clean-up operation, will replace Tony Hayward as chief executive in October.
Mr Dudley described the oil spill as a terrible tragedy from which the company and the industry would learn a lot.
Earlier, BP reported a record $17bn (£11bn) loss, having set aside $32bn to cover the costs of the spill.
The loss for the three months to June was the largest quarterly loss recorded by a British company.
"[BP] will be smaller and financially, it will grow," Mr Dudley told ABC's Good Morning America programme.
"We are going to share our learnings from this, it's no doubt going to change the oil and gas industry all around the globe as a result of it."
Mr Hayward, who is leaving by mutual consent, is likely to retain a role within the company. BP plans to nominate him as a non-executive director of its Russian joint venture, TNK-BP.
BP also announced it would increase its asset sales over the next 18 months to $30bn, a total that includes the $7bn-worth earmarked for sale last week.
The $32.2bn cost of the clean-up includes the $20bn already set aside under pressure from the US government for compensation claims.
"That estimate is also based on our belief that we are not grossly negligent," BP chairman Carl-Henric Svanberg told the BBC's business editor Robert Peston.
"Of course we will not know precisely because it depends on how many claims are coming in and [other] things that could happen."
But he insisted that the company was in good financial shape, with strong cashflow.
"It's of course a huge loss that overshadows everything else, but the underlying performance of the company is actually strong," he told the BBC.
"There is no worry about our financial position and our ability to get through this. It's of course a tragedy and it has large consequences, but we have no doubt that we will be able to rebuild the company," he said.
Stripping out the oil spill costs, BP made a second quarter profit, on a replacement cost basis, of $5bn, compared with $2.9bn for the second quarter of 2009.
The announcements were welcomed by most investors for their clear-cut approach.
Peter Hitchens, of Panmure Gordon stockbrokers, said: "It's basically a kitchen sink job...
"I think it's the board trying to wipe the slate clean."
Tony Hayward said that, now oil had stopped spilling from the Macondo well, it was a good time to leave his post.
"With the leak now capped, we have reached a significant milestone. This provides a firm basis to reshape the company," he said.
On Monday, the BBC revealed that 53-year old Mr Hayward will receive a year's salary plus benefits, together worth more than £1m.
He will also be entitled to draw an annual pension of £600,000 once he reaches the age of 55.
Mr Hayward's pension pot is valued at about £11m and he will keep his rights to shares under a long-term performance scheme which could - depending on BP's stock market recovery - eventually be worth several million pounds.
Carl-Henric Svanberg said Mr Hayward would be missed.
"The BP board is deeply saddened to lose a CEO whose success over some three years in driving the performance of the company was so widely and deservedly admired," he said.
The handling of the explosion on the drilling rig off Louisiana on 20 April, which killed 11 workers and triggered the worst oil spill in the US, raised questions about Mr Hayward's leadership.