His announcement came after he came out of a meeting with the chairman of the Pakistan Cricket Board (PCB), Najam Sethi, giving rise to speculations that he was told to resign or face the axe.
But the 33-year-old insisted during a hurriedly called media conference at the Gaddafi stadium in Lahore that it was his own decision.
"I take responsibility for the team's poor performance after the high expectations everyone had from us in the World T20," Hafeez said.
"No one has forced me to resign... I think this is the right thing to do because as captain I am responsible for the good and bad performances of the team," he stated.
Hafeez said he was also stepping down as vice-captain of the Test and one-day sides.
The allrounder, who has played an influential role in the Pakistan team as captain and senior player in the last few years and who had a big say in selection matters, was made national T20 captain in place of Misbah-ul-Haq in 2012.
Pakistan were soundly beaten by West Indies in a do-or- die match on Tuesday, which put them out of the World T20 -- a tournament in which they have always qualified for the semi-finals since its inception in 2007.
Hafeez, who has played 36 Tests, 146 ODIs and 58 T20 internationals, said he would be available as a player for all three formats and it was for the selectors to decide what to do.
"Now whoever the board appoints as captain I will be there to support him. I have played under captains as well and always given my best," he added.
Related Links:
- Younis Khan, Misbah-ul-Haq tons put Pakistan in commanding position in 1st Test against Sri Lanka
- ICC World T20 2014: Pakistan shift focus after Asia Cup loss
- Cricket - Windies sweep into semi-finals
- Spin vital to India's early World T20 success
The PCB chief met with Hafeez and the head coach of the team, Moin Khan and senior cricket consultant, Zaheer Abbas to discuss the performance of the team and insiders say that both Moin and Zaheer had given a pretty negative report about Hafeez's captaincy in the World T20.
Moin later faced the media and was asked if he would also be stepping down.
"There is no question of me stepping down as my contract was for the Asia Cup and World T20 and it is over now. I think not everyone can accept responsibility for the team's performance," he said.