TOKYO (Reuters) - Japan’s parliament on Friday passed a law allowing Emperor Akihito to abdicate, clearing the way for the first abdication by a Japanese monarch in nearly two centuries and the accession of his son, Crown Prince Naruhito, probably late next year.

Akihito, 83, who has had heart surgery and treatment for prostate cancer, said in rare public remarks last year he feared age might make it hard for him to continue to fulfill his duties.

The soft-spoken Akihito, the first Japanese emperor who was never considered divine, has worked for decades at home and abroad to soothe the wounds of World War Two, fought in his father Hirohito’s name. He will be succeeded by Naruhito, 57.

In a vote televised live on NHK public television, the upper house of parliament passed the bill with a handful of lawmakers sitting out the vote. It cleared the more powerful lower house last week.

“Abdication will take place for the first time in 200 years, reminding me once again of how important an issue this is for the foundation of our nation, its long history, and its future,” Prime Minister Shinzo Abe told reporters after the vote.

Now the government has to hammer out the details of the abdication, including the timing, but media reports have said it is likely to take place at the end of 2018, which would mark three decades on the Chrysanthemum throne for Akihito.

The abdication, the first since 1817, appears to have support among the general population, who view it as a sign of changing times.

“In essence, the emperor is resigning, which I feel was an issue of personal thought,” said Masayoshi Matsumoto, a 47-year-old animator.

“People live much longer these days. I think while on the one hand it pains him not to be able to carry out his duties properly, he may also wonder why he should have to do the job this long.”

The government also has to ensure the continuity of a monarchy beset by a shortage of male heirs and shrinking pool of imperial family members. Women are not allowed to inherit the throne and leave the family upon marriage, an issue highlighted last month with the announcement that the Emperor’s oldest granddaughter will marry a commoner.

The law, which applies only to Akihito and not to future emperors, included a resolution to debate letting female royals stay in the imperial family after marriage but did not touch on the controversial topic of allowing women to inherit.

“I believe we will look into all these issues rather broadly,” said Koichi Hagiuda, deputy chief cabinet secretary, at a news conference.

Many conservatives oppose the idea of an empress, but some Japanese think the monarchy should also move with the times on this.

“I have no problem with an empress, there are plenty of women royals ruling overseas,” said Yukinori Kumakiri, 61-year-old man working for an electrical company.

“After all, the emperor is a symbol, it’s not as if they really have power. They’re a representative of the Japanese people and man or woman shouldn’t matter.”