The speaker of the Parliament, Jacob Mudenda, read out a letter in which Mr. Mugabe said he was stepping down “with immediate effect” for “the welfare of the people of Zimbabwe and the need for a peaceful transfer of power.”
Lawmakers erupted into cheers, and jubilant residents poured into the streets of Harare, the capital. It seemed to be an abrupt capitulation by Mr. Mugabe, 93, the world’s oldest head of state and one of Africa’s longest-serving leaders.
“It’s the best thing that’s ever happened to Zimbabwe,” Perseverance Sande, 20, said in central Harare minutes after news of the resignation began spreading, as crowds of people started singing around her. “I’ve been waiting so long for this moment.”
Mr. Mugabe had refused to step down even after being expelled on Sunday from ZANU-PF, the political party he had led for four decades.
Then on Tuesday, party members introduced a motion of impeachment, invoking a constitutional process that had never before been tested.
The party’s political rival, the Movement for Democratic Change, seconded the motion, a striking sign of the consensus in the political class that Mr. Mugabe must go — one that formed with astonishing speed after the military took Mr. Mugabe into custody last Wednesday.
CreditBen Curtis/Associated Press
Lawmakers had moved their gathering from Parliament to a large conference hall at a hotel and were discussing the impeachment motion when Mr. Mugabe’s justice minister, Happyton Bonyongwe, walked up to the stage.
He was booed, because of a rumor that he had been offering bribes to sway votes against impeachment. Then he whispered into the ear of Mr. Mudenda, the speaker, and handed him a letter.
Calling the lawmakers to order, the speaker announced that he had received an urgent communication from the president. As the crowd grew quiet, Mr. Mudenda — with a wide smile across his face — read out the letter.
Lawmakers immediately screamed and shouted. Once-bitter rivals from ZANU-PF and the Movement for Democratic Change shook hands and hugged.
Even Mr. Mugabe’s closest allies appeared taken aback. Reached by telephone, George Charamba, the president’s longtime spokesman, who participated in discussions in recent days between Mr. Mugabe and the military, declined to comment, saying only, “I’m concerned about the stability of my country.”
In Africa Unity Square, the capital’s main public area, scattered shouts were heard a few minutes after the announcement by the speaker. Then, as word began spreading by mouth and by phone, the shouts, cries and honking of cars rose in a deafening crescendo. Hundreds of people ran to the square, hugging and jumping, as the crowd soon swelled into the thousands.
“I’m happy,” said Presca Nzendora, 32, a street vendor who was hugging a friend, jumping up and down. “Bob has resigned! We were starving because of him.”
Bryan Moyo, 30, who works in internet security, ran into the middle of the square in his dark suit and red tie. “Thirty-seven years is not a joke,” he said. “He’s the only president I’ve ever known. It’s indescribable. It’s been hell. I feel like we’ve been liberated a second time.”
Nicholas Nyamaka, a 65-year-old taxi driver, said, “I used to think it would never come. It’s a dream come true. So finally the suffering is over.”
The state broadcaster interrupted the airing of an agricultural program to report that Mr. Mugabe had resigned and that a new leader could be sworn in as early as Wednesday. Emmerson Mnangagwa, the vice president whom Mr. Mugabe abruptly fired last week, setting off an internal revolt, is widely expected to lead the country, at least until national elections scheduled for next year.
With the end of the Mugabe era, some who have found themselves on the wrong side of history were quickly readjusting their positions on Tuesday night.
Reached by phone, Philip Chiyangwa, a nephew of Mr. Mugabe and an ally of the president’s wife, Grace, said: “It’s fantastic! It’s the best news in 37 years!”
In an interview with The New York Times in 2016, Mr. Chiyangwa said he was a member of G-40, the faction that had been led by Ms. Mugabe. But on Tuesday night, he denied ever having been a member. “No, no,” said Mr. Chiyangwa, who is one of the country’s most prominent businessmen and also president of the Zimbabwe football association.
Mr. Chiyangwa said he had never benefited from his family connection to Mr. Mugabe.
“Yes, we’re related,” he said. “But being related does not necessarily mean there was any economic relations between us — none at all.”
For nearly four decades, Mr. Mugabe managed to stay at the helm by handing out the spoils of power to his allies — and by crushing dissent. He oversaw the massacre of thousands of civilians in the 1980s and outmaneuvered rivals in his party and in the opposition. Even in his 90s and weakened by age, he kept potential successors at bay.
But he pushed too hard by trying to position his wife, 52, as his successor. She entered politics only two years ago, had no role in the nation’s liberation war and treated with open contempt politicians who had been waiting decades to succeed her husband.
The chain of events leading to Mr. Mugabe’s downfall started on Nov. 6, when he fired Mr. Mnangagwa, clearing the way for Mrs. Mugabe to take over the presidency at some point. Mr. Mugabe then tried to arrest the nation’s top military commander a few days later.
After the military took Mr. Mugabe into custody, ZANU-PF expelled him as its leader on Sunday. But Mr. Mugabe stunned the nation that evening with a televised address in which he refused to step down as president. Pressure from within the country and from abroad had been building on Mr. Mugabe to resign, but observers had warned that the country might have to brace itself for lengthy impeachment proceedings.
The motion of impeachment introduced on Tuesday alleged, among other things, that Mr. Mugabe had violated the Constitution; that he had allowed his wife to usurp power; and that he is too old to fulfill his duties.
“He should take heed of this clarion call by the people of Zimbabwe to resign so that the country can move forward and preserve his legacy,” Mr. Mnangagwa said.
Mr. Mnangagwa’s words, as well as his continued absence, appeared to be part of an effort by his allies to distance him from the military intervention and to portray it as a reflection of the popular will. The army stepped in two days after the president attempted to arrest the country’s top military commander, Gen. Constantino Chiwenga, a close ally of Mr. Mnangagwa.
Mr. Mnangagwa’s role as the likely successor to Mr. Mugabe has engendered some skepticism.
Mr. Mnangagwa was accused of orchestrating the crackdown in the 1980s in which thousands of members of the Ndebele ethnic group were killed. He was an avid supporter of Mr. Mugabe’s most controversial economic policy — the expropriation and redistribution of land that had been controlled by white farmers since the era of colonialism. He was also accused of being behind deadly violence in 2008 a bid to rig polls in favor of Mr. Mugabe, a claim he denies.
“He is now saying it is important to be part and parcel of what the people are saying when the people’s voices have been ignored so far,” said Okay Machisa, the executive director of ZimRights, a human rights group.
At least a semblance of legitimacy — especially for a government under Mr. Mnangagwa, who is known as the enforcer of some of Mr. Mugabe’s most ruthless policies — will be critical in gaining recognition from regional powers, Western governments and international lenders. Zimbabwe, which no longer has its own currency and perennially struggles to pay government workers, became a pariah in the West after the state-backed invasion of white-owned farms in the early 2000s.
On Tuesday, Prime Minister Theresa May of Britain, Zimbabwe’s former colonial ruler, welcomed news of his departure.
“The resignation of Robert Mugabe provides Zimbabwe with an opportunity to forge a new path free of the oppression that characterized his rule,” she said in a statement.
“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. 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.”
CreditLynsey Addario for The New York Times
The United States Embassy in Zimbabwe issued a statement welcoming “an historic moment” for the country and urged “unwavering respect for the rule of law and for established democratic practices.” It said that “the path forward must lead to free, fair and inclusive elections.
At the United Nations, Farhan Haq, a spokesman for Secretary General António Guterres, said the secretary general was following the developments in Harare and urged Zimbabweans “to be calm.”
Mr. Haq would not comment directly on the resignation, but said that “this secretary general and his predecessors have made clear that we expect all leaders to listen to their people.”
In keeping with efforts to minimize the backlash against last week’s intervention, the military allowed Mr. Mugabe to try to convene a cabinet meeting on Tuesday morning. Just five ministers turned up; 17 others attended impeachment meetings.
While Mr. Mugabe’s resignation caused immediate jubilation in the streets and among lawmakers, for many the reaction was more complex: Mr. Mugabe had occupied a central role in the nation’s four-decade history and in its founding mythology, which all Zimbabweans are taught in primary school. He was a tyrant, many said, but he was also the nation’s father figure.
Even as military leaders met Mr. Mugabe in recent days before the cameras, their body language showed extreme deference. His fiercest critics saved their harshest words for Mr. Mugabe’s wife and her political allies, often describing the president, who has become visibly frail in the past two years, as a victim of the people surrounding him.
Christopher Mutsvangwa, the head of the war veterans association and one of Mr. Mnangagwa’s closest allies, led efforts to remove Mr. Mugabe from power. But as ZANU-PF lawmakers met separately before Parliament convened, he sometimes sounded melancholy about Mr. Mugabe, with whom he had worked decades before a falling out last year.
Mr. Mutsvangwa, who once served as Zimbabwe’s ambassador to China, compared Mr. Mugabe and his wife to Mao Zedong and Jiang Qing, the Chinese leader’s fourth wife, who, toward the end of Mao’s life, assumed great power as part of the Gang of Four.
“He’s a traumatized old man,” Mr. Mutsvangwa said of Mr. Mugabe, suddenly growing quiet.
Even among the celebrants in Unity Square, some wore quiet, almost sad expressions.
David Mushakwe, 35, a car electrician, stood quietly as he watched hundreds of mostly young men jumping on trucks on the edge of Unity Square, in front of Parliament. Lawmakers had met in the building in the morning and then moved to a hotel in another section of the city for a joint session of Parliament in the afternoon.
“I just want to say to His Excellency, ‘Go and rest now, our father,’” Mr. Mushakwe said. “We still love you. But we’re happy today. We’re hoping now for a better future.”