Zimbabwe's President Robert Mugabe has resigned, ending his 37-year rule of the country.

The parliamentary speaker made the announcement, stopping impeachment proceedings against Mr Mugabe to say he had received a resignation letter from him "with immediate effect".

An official from Zimbabwe's ruling party, ZANU-PF, said the recently-fired vice president Emmerson Mnangagwa will take over as leader within 48 hours.

"My decision to resign is voluntary on my part and arises from my concern for the welfare of the people of Zimbabwe and my desire for a smooth, non-violent transfer of power," Mr Mugabe said in his letter which was read out in parliament, sparking cheers and dancing.

Cars began honking horns and people cheered in the streets, as the news spread like wildfire across the capital, Harare.

Before the resignation, crowds rallied outside parliament, dancing and singing.

Some people placed photos of Mr Mugabe in the street so that cars would run over them.

Opposition leader Morgan Tsvangirai of the MDC party said the culture of the ruling party, ZANU-PF, "must end" and everyone must put their heads together and work toward free and fair elections.

Mr Mugabe's resignation follows moves by both Zimbabwe's ruling and opposition parties to impeach the 93-year-old leader.

Impeachment allegations against Mr Mugabe included that he "allowed his wife to usurp constitutional power" and that he is "of advanced age" and too incapacitated to rule.

Mr Mugabe also was accused of allowing unpopular first lady Grace Mugabe to threaten to kill former vice president Emmerson Mnangagwa and other officials.

Earlier today pressure had come from Mr Mnangagwa, who said Mr Mugabe should acknowledge the nation's "insatiable desire" for a leadership change and resign immediately. It is a stunning end for what was the world's oldest head of state.

Mr Mugabe has been in charge since the end of white minority rule in 1980, but the military moved in last week after he fired Mr Mnangagwa and appeared to position the polarising first lady to succeed him.

The prospect of a dynastic succession alarmed the military, which confined Mr Mugabe to his home last week and targeted what it called "criminals" around him who were allegedly looting state resources - a reference to associates of the first lady.|

British PM Theresa May said his resignation allows Zimbabwe to move on "free of the oppression that characterised his rule".

"In recent days we have seen the desire of the Zimbabwean people for free and fair elections and the opportunity to rebuild the country's economy under a legitimate government," Ms May said.

"As Zimbabwe's oldest friend we will do all we can to support this, working with our international and regional partners to help the country achieve the brighter future it so deserves."