Hashim Amla has resigned as South Africa captain following the second Test against England at Newlands. AB de Villiers will take over for the final two Tests of the series in Johannesburg and Centurion.

Amla has come in for criticism of his leadership since the start of the series but had returned to form with the bat in Cape Town with 201 in South Africa's only innings. Amla was named as Graeme Smith's replacement as captain in mid-2014 and this was his sixth series in charge. After winning his first three against Sri Lanka, Zimbabwe and West Indies, he oversaw a rain-affected drawn series against Bangladesh and the 3-0 defeat in India.

In a statement, Amla said: "This decision has not an easy one to make I felt I had to be true to myself. I am comfortable with my decision and I feel I need to work on my own game.

"I was deeply honoured when the position was given to me. Throughout my time as captain, I have always had the support of my team-mates and coaching staff . I remain committed to the Proteas across all formats and I will fully support whoever is shown as my successor."

Amla said that he had begun to think about stepping down two weeks ago, before the start of the series against England. South Africa are currently 1-0 down, after defeat in Durban, but emerged with credit after a hard-fought draw in Cape Town.

"Captaining your country is probably the pinnacle," he said. "Why I did it now, it just so happened I got 200 and it fitted nicely that the South African team did exceptionally well on the last day. It was coming for the last two weeks.

"I had chatted to a few of the guys in the team before this, so I don't think it had come as a massive shock," he added. "We have a very tight leadership team: myself, AB, Faf [du Plessis]. AB is very able and a brilliant leader and we will all follow similar goals. Whether I'm pulling the rope, or AB is pulling the rope or Dale [Steyn] is pulling the rope, as long as someone is going in the right direction, we all will go with him."

Despite reports that Amla had, at times, been a reluctant captain during his two-year tenure, he insisted he had not had to be coerced into the role in the first place, and that his decision to stand down was also entirely his own.

"It was always my decision," he said. "In life I have learned that if you are going to do something, you've got to do something you enjoy. I've always enjoyed captaincy.

"When Graeme stepped down, it gave an opportunity for me to explore my captaincy. I thought at the time I could add value and I'd like to believe that I have added value. I am really surprised some people have suggested it was not my choice. You don't look like me in this world without being firm on what you want to do."

"The decision has been purely based on that I think somebody else can do a better job. It was just something that crossed my mind and was working on my mind. My leadership style, and we have a very young team, maybe somebody else would have done a better job."

Haroon Lorgat, the CSA chief executive, said: "We respect Hashim's decision and the manner in which he thought about it and then communicated with me. It was consistent with his well respected personality

"He still has a huge role to play in shaping the success of our team without the need for a leadership title. He is just that type of a person and we are very fortunate to have him in our stable.

"I want to thank AB for readily accepting the challenge of rebuilding our Test team as we seek to remain the best team in the world."

De Villiers said that while being handed the job in such circumstances was not ideal, it would allow him to fulfil a dream of captaining his country in Test cricket.

"I've said this before that it is an incredible honour to captain South Africa in any format. The captaincy has obviously come at short notice and is the realisation of a lifelong dream," de Villiers said.

"At the moment my priority and focus is placed on leading this team to what can be a memorable series win against England. This Test squad is motivated and determined to turn our performances around and I'm looking forward to taking up that challenge as captain. Hashim is a good friend and close colleague and I am grateful for his support."

Russell Domingo, South Africa's coach, added that de Villiers was the frontrunner for the role full-time, but said that the selectors would make a long-term decision at the end of the England series. He added that Amla's achievements as South Africa's captain stood up to scrutiny in spite of the criticism he received during his time in charge.

"I feel that there hasn't been enough respect shown for what he has achieved as a player," he said. "People can say what they want to, [but] he is still averaging 45 as captain. He has gone to Zimbabwe, won a series there, gone to Sri Lanka and won a series there which no other captain has done. He won a series against West Indies. He has gone to India where a lot of captains have lost under tough conditions, and we've come here with six new players who have all played under 10 Test matches.

"He has sacrificed himself for the rest of the team which speak volumes for him, and people need to appreciate that type of character and it seems we sometimes undervalue that on the field. He has got a lot of experience, and expertise and advice that he can give, particularly the younger players in the side."