LONDON—Tony Hayward, the departing chief executive of BP PLC, is unrepentant about how the energy giant responded to the U.S.'s largest offshore oil spill.

In his first interview after agreeing to step down from the top spot this week, Mr. Hayward said he did everything possible once the Deepwater Horizon rig exploded and sank in the Gulf of Mexico, by taking responsibility for the spill, and spending billions of dollars to stop the spewing oil and clean up the shoreline.

At the onset more than three months ago, Mr. Hayward was attacked for saying BP could contain the spill and prevent an environmental disaster. That, plus a series of other missteps and failed efforts to stop the runaway well, made Mr. Hayward a toxic symbol in the U.S. for the unfolding mess.

"I became a villain for doing the right thing," Mr. Hayward said in the interview. "But I understand that people find it easier to vilify an individual more than a company." He said he feels some of his comments, particularly "I'd like my life back," were "wrong."

On the Obama administration, he said he resented the daily onslaught of criticism, but added: "I understood their frustration."

Mr. Hayward made clear he wanted to stay, but decided it would hurt BP as its works to permanently cap the well, and repair the Gulf coastline and the company's public image. "I didn't want to leave BP, because I love the company," Mr. Hayward said in the interview. "Because I love the company, I must leave BP." Earlier this week, BP announced he would step down as its leader Oct. 1.

He added: "In America, the road back will be long but I believe achievable when the whole truth of the accident finally emerges and the Gulf coast is restored....BP can rebuild faster in America without Tony Hayward as its CEO."

Click here for more on this story from The Wall Street Journal