TOKYO — Prime Minister Shinzo Abe of Japan said on Friday that he was resigning because of ill health, thrusting his country, during a global pandemic, into a new period of political uncertainty after a record-setting tenure that provided unaccustomed stability at the top.
Mr. Abe, 65, announced his decision to step down just four days after he had set a record for the longest uninterrupted run as Japanese leader — nearly eight years — but before he had achieved some of his most cherished ambitions.
Since taking over at the end of 2012 as the sixth prime minister in five years, he had overseen Japan’s recovery from a devastating earthquake, tsunami and nuclear disaster, restored the country to a semblance of economic health, and curried favor with an unpredictable American president, Donald J. Trump.
Yet despite his long hold on power — it was his second stint as prime minister, having held the post from 2006 to 2007 — Mr. Abe fell short of his ultimate goal of revising the pacifist Constitution installed by the United States after World War II. He was also unable to secure the return of contested islands claimed by both Japan and Russia so that the two countries could sign a peace treaty to officially end the war.
And in an often emotional news conference Friday evening, Mr. Abe expressed regret for a third unfulfilled ambition: securing the return of Japanese citizens kidnapped by North Korea decades ago.
Explaining his decision to step aside, Mr. Abe told reporters that he had suffered a relapse of ulcerative colitis, the bowel disease that led him to resign after just a year during his first stint in office.
He said that he wanted to make way for a new leader who could focus fully on tackling the coronavirus pandemic and other challenges, and that he felt the timing was right because Japan had seemed to have gotten its second wave under control.
“I don’t want to make mistakes in important political decisions” while undergoing treatment, Mr. Abe said. “I decided I shouldn’t continue sitting in this seat as long as I cannot respond to the mandate of the people with confidence.”
His conservative governing party, the Liberal Democratic Party, is expected to elect a leader within coming days or weeks, according to NHK, the public broadcaster. Mr. Abe’s term was set to expire in September 2021.
The leading candidates to replace Mr. Abe include Taro Aso, the long-serving deputy prime minister and a former prime minister; Yoshihide Suga, the chief cabinet secretary to Mr. Abe; Shigeru Ishiba, a former defense minister who once ran against Mr. Abe for party leader; and Fumio Kishida, a former foreign minister.
Mr. Abe declined to name a favorite, saying they were all “very promising.”
The Japanese news media had been speculating about Mr. Abe’s health for weeks, particularly after he significantly dialed back public appearances as a new wave of coronavirus infections erupted in clusters throughout the country. When Mr. Abe visited a hospital twice in the span of a week, the rumor mill went into overdrive.
Earlier on Friday, Mr. Suga had reassured reporters that Mr. Abe intended to remain in office. “The prime minister himself has said he would like to work hard again from now on, and I’m seeing him every day,” he said, adding that the prime minister’s health “remains unchanged.”
But Mr. Abe said he had actually decided on Monday, after a visit to the hospital, that he should resign, although he said he would stay until a successor was chosen. “As I’m in the middle of treatment, I judged that this is the only timing that will not create a vacuum of political leadership,” he said.
When Mr. Abe, the grandson of a prime minister accused of war crimes and the son of a former foreign minister, resigned during his first term after a scandal-plagued year in office, he cited the debilitating effects of ulcerative colitis, which has no known cure.
At the news conference on Friday, Mr. Abe said he had been told by doctors a few months ago that they had found signs of a relapse of the disease. He said that he had since lost much of his strength, and that he would now step aside so he could receive treatment with a new drug that he called promising.
Mr. Abe, whose public approval ratings have plummeted into the 30s as the economy has faltered during the pandemic, said he would remain a member of the lower house of Japan’s Parliament and continue to help his party pursue its goals.
During his second period in office, beginning in late 2012, Mr. Abe survived several influence-peddling scandals and rode out numerous elections. In 2015, he pushed through contentious security legislation that permitted Japanese troops to engage in overseas combat missions alongside allied forces, as part of “collective self-defense.”
His political power peaked in 2017, when his party won a landslide victory that gave it, along with its coalition partners, two-thirds of the seats in Parliament. That was the supermajority required to push through a constitutional revision, but Mr. Abe never brought that nationalist dream to fruition, with public opposition to such a change remaining high.
Still, perhaps uniquely among world leaders, Mr. Abe developed a close personal relationship with Mr. Trump that many in Japan believe helped avert punishing trade deals or demands that Japan pay more to support close to 55,000 American troops on bases across the country.
He also held together a coalition of 11 countries around the Pacific Rim in a trade agreement, the Trans-Pacific Partnership, after the Trump administration pulled the United States out.
And before the pandemic and China’s increasingly authoritarian moves in Hong Kong and around the South China Sea, Mr. Abe had pursued warmer ties with China and its leader, Xi Jinping, reversing years of frosty relations.
“I think Abe’s biggest legacy for his successor is that he managed to stay in power in Japan longer than any other prime minister,” said Kristi Govella, an assistant professor of Asian studies at the University of Hawaii at Manoa. “He managed to really elevate Japan’s profile on the international stage and make substantial changes in policy across a number of issue areas, and in Japan that is something we have not seen very often.”
Mr. Abe also helped secure the 2020 Summer Olympics for Tokyo, but they have been postponed until 2021 because of the pandemic.
But by the time he decided to resign, Mr. Abe’s disapproval ratings had risen to their highest level since he began his second term.
“I want to celebrate his resignation,” one poster wrote on Twitter. “But he did whatever he wanted without consequences and people celebrated him for exceeding the record for longest consecutive days served in office. And now he just gets to escape, so I feel angry.”
But analysts said that the political opposition, divided and disorganized, was unlikely to be able to take advantage of Mr. Abe’s resignation.
“For the sake of Japanese democracy, they should try,” said Kunihiko Miyake, a former Japanese diplomat who is now teaching at Ritsumeikan University in Kyoto. “But I don’t think they can do it. They are not even united, and there is no discussion of policies.”
The public has been dissatisfied with Mr. Abe’s handling of the coronavirus, particularly its effects on the economy, which erased what achievements he could claim under his economic platform, known as “Abenomics.”
Under that program, Mr. Abe had administered a three-pronged plan of monetary easing, fiscal stimulation and corporate reform. Some of its promises — including efforts to empower women, reduce the influence of nepotism and change entrenched work culture — remained unfulfilled.
“Abe wanted to be a transformational prime minister,” said Tobias Harris, an expert on Japanese politics at Teneo Intelligence in Washington and the author of “The Iconoclast: Shinzo Abe and the New Japan.”
“But the most difficult, potentially transformative decisions about Japan’s place in the world will be made by his successor, because Abe ended up being a prime minister who prioritized stability over the risks of transformation.”
Makiko Inoue and Hikari Hida contributed reporting.