TOKYO — Shinzo Abe declared victory in national elections Sunday, ensuring his place in history as Japan’s longest-serving prime minister at a time when the country faces numerous challenges, including a rapidly aging population, tensions with its neighbors in Asia and coming trade talks with an unpredictable counterpart in the White House.

Official results are not expected until Monday, but public broadcaster NHK said that Abe’s conservative governing coalition had won a majority of seats in the upper house of parliament.

But in a setback for Abe in an otherwise victorious election, his coalition did not secure the number of seats needed to fulfill his long-cherished ambition of revising a pacifist constitution that has been in place since American occupiers created it in 1947.

“We have been able to gain a majority,” Abe said as results were being tabulated Sunday night. “And I believe that the voters wanted a stable foundation in politics.”

The projected result, in which Abe’s Liberal Democratic Party and its allies hold on to power, represented a striking moment for the prime minister.

A dozen years ago, he was forced to resign in disgrace after one year as prime minister, following a humiliating defeat of his party in a parliamentary election. Now, Abe, who returned to power in 2012 and has presided over an extended period of political stability, is just four months shy of setting Japan’s leadership record.

Advertising

Abe tried to play down the significance of not capturing enough seats to initiate constitutional revision.

“This is not about whether or not we gain the two-thirds majority,” Abe said. “This is whether or not we can have a stable ruling bloc.”

Yet the failure to win a supermajority thwarts one of Abe’s signature goals. The constitution calls for the renunciation of war, and Abe has long stated his desire to change it to allow Japan to strengthen its military.

During the campaign, Abe did not emphasize his desire to revise the constitution. Rather, he focused on promising to secure the country’s finances and touted his personal relationship with President Donald Trump, while questioning the ability of any of several opposition parties to govern effectively.

“We have been saying do you want a stable government or chaos?” he said Sunday.

Abe’s electoral victory came despite his struggles to accomplish his other professed goals, including turbocharging the economy, raising the country’s sluggish birthrate and drastically increasing the proportion of women in management and politics.

Advertising

In many ways, Abe’s success stems from the lack of a strong opposition rather than a public mandate for his party’s vision.

“The opposition is no good,” said Makoto Mugikura, 68, a voter who had wandered into Abe’s final campaign rally Saturday night because he had happened to be in the neighborhood. “There is nothing but the Liberal Democrats.”

NHK reported that voter turnout, below 50%, was the second lowest in the history of elections for the upper house of parliament. Heavy rain in southern Japan may have suppressed some voting, but resignation may have also been a factor.

“They just don’t feel their vote makes a difference,” said Donna Weeks, a professor of politics at Musashino University.

Some analysts said the media had also given short shrift to campaign coverage, which contributed to voter disinterest. “A lot of people abstain because they don’t even know that an election is going on,” said Koichi Nakano, a political scientist at Sophia University in Tokyo.

Abe has worked hard to establish himself as a leader on the world stage, persistently courting Trump and working to improve ties with President Xi Jinping of China. During Trump’s visit to Japan in May, the relationship seemed to pay off when the American president said on Twitter that he would hold off on thorny trade negotiations until after the Japanese election.

Such global visibility has helped Abe establish himself with voters as the best choice to steer Japan. He also has the benefit of leading a party that, one way or another, has been in power for most of the postwar period.

“It’s the Liberal Democrats that have built Japan to what it is now,” said Yukiko Miyago, 80, after voting in the Asakusa district of Tokyo early Sunday. “Aren’t people enjoying affluent living in this society with developed technology, science, information and all?”

With five major opposition parties, many voters have a hard time keeping them straight. New parties crop up in each election as old parties split and reconstitute.

“The opposition’s problem comes down to marketing and identity,” said Jeffrey W. Hornung, a political scientist at the Rand Corp. who focuses on Japan. “It’s hard to be able to have any sort of consistent voice when you come and go with different elections, and Abe and the LDP have been able to capitalize on that.”

Still, Abe’s party lost some seats as voters appeared to reject his long-held goal of constitutional revision. The public is split on whether it supports Abe’s plans, with about half supporting strong security provisions and the other half strongly advocating pacifism.

“I don’t support the revision of the constitution,” said Emiko Akaishi, 43, who voted for candidates from opposition parties.

Advertising

“The current politics under the ruling party seems to be arrogant,” said Akaishi, who works at a film-production company and was voting at the Chofu polling station in a suburb of Tokyo Sunday morning. “They just do whatever they want to do.”

Some of the opposition parties hoped to distinguish themselves by putting forward more female candidates.

Under a law enacted last year, Japan’s political parties are encouraged to strive for gender parity in their candidates. A record 28% of candidates in the election Sunday were women, with the Constitutional Democratic Party offering a slate that was almost half female.

While Abe often says he envisions a society in which “women can shine,” fewer than 1 in 6 candidates for the Liberal Democratic Party were women, and there is only one woman in his Cabinet.

Abe’s agenda for women is “window dressing,” said Noriko Sakoh, author of “Doing Too Much Housework Will Destroy Japan.” She pointed to government policies such as tax abatements for husbands whose wives do not work and persistent waiting lists for government-subsidized day care despite the low birthrate.

Sakoh said she was attracted to a new progressive party called Reiwa Shinsengumi, which is backing a range of candidates from diverse backgrounds, including a single mother and two people with physical disabilities. On Sunday evening, Kyodo News reported that Yasuhiko Funago, a candidate who uses a wheelchair and has amyotrophic lateral sclerosis, and Eiko Kimura, who has cerebral palsy, had won seats.

Advertising

In a country where one-fifth of the population is 70 or older, all the major parties focused on the national pension system during the campaign.

Just under two months before the election, the Financial Services Agency, a government regulator, warned that the country’s social security system would not be able to support the living standards of older residents through retirement. Given the long life expectancies in Japan, the agency’s report suggested that an average couple would need an additional 20 million yen ($185,000) to live comfortably.

Officials in the Abe administration swiftly repudiated the report, and on the campaign trail Abe promised to increase annual pensions for low-income retirees by about $560.

Such pledges rang hollow to some protesters who showed up for Abe’s final rally on Saturday, shouting “Abe quit!” and “Don’t bully poor people!”

Abe has said the government will fund the payments by encouraging more women and older people to work, and his party has vowed to raise the country’s consumption tax to 10% in the fall, as previously scheduled.

All five major opposition parties said they would not raise the tax.

Advertising

A supporter at the rally on Saturday said he did not plan to depend on the government for his retirement.

“I will take care of myself,” said Ichiro Hasumi, 65, a retired shipping company worker who said he was voting for Abe’s party because “he will best protect the national interest.”

“It’s Japan first,” he added.

For the opposition, it can be hard to counter the inertia that has kept Abe in office.

“Opposition parties tend to get pushed into an anti-Abe or anti-status-quo position,” said Kristi Govella, an assistant professor of Asian studies at the University of Hawaii at Manoa. “And that can be a difficult place to build a base of new, exciting policy ideas from.”