JAKARTA - Sri Sultan Hamengkubuwono X, the 10th ruler of Yogyakarta, comes from a long line of Javanese royalty, in which the throne is passed down from father to son over generations.
He is also the city's governor, a political position he was democratically elected to in 1998 - an anomaly for any royal family.
A highly respected figure, the 71-year-old Sultan almost ran for president in 2009 with Golkar, then Indonesia's largest political party.
Some electability polls at the time even showed him to be more popular than Vice-President Jusuf Kalla, but he later decided against running for the top office.
Last week, President Joko Widodo re-appointed him as governor, after a 2012 law on Yogyakarta's special region status included provisions that declared the Sultan to be its ex-officio governor.
Speaking to reporters last week ahead of his inauguration, Sultan Hamengkubuwono X said he hopes to provide comfort, security and prosperity for his people.
"That means building a Yogyakarta that helps (its people) achieve prosperity and live in a society of quality," he said.
Under the 2012 law, the ruler of the sultanate will automatically be appointed governor on a five-year renewable term.
The law was enacted with little opposition then because a majority of Yogyakartans still hold great pride in the role the Hamengkubuwono family played in Indonesia's fight for independence, said observers.
Constitutional law expert Irman Putra Sidin told The Straits Times that the privilege is also made possible because unlike other provinces, Yogyakarta was already a sultanate long before Indonesia was founded as a modern republic.
This unusual arrangement can be traced back to the country's struggle for independence against the Dutch from 1945 to 1949, decades before the current law was passed.
In recognition of his support for the nationalist movement, the Sultan's father, Sultan Hamengkubuwono IX, was declared governor of the newly created special administrative region of Yogyakarta in 1950.
The position was accorded to the Sultan and his rightful descendants to the throne, for life.
The Yogyakarta legislature at the time also backed the automatic appointment of the Sultan as governor, although the royal right would be challenged in the decades ahead.
Born Herjuno Darpito, Sultan Hamengkubuwono X ascended the throne in 1989, shortly after his father's death.
The position of the governor, however, did not go to him but was instead given to Prince Paku Alam VIII, who was deputy governor.
After the fall of then President Suharto in May 1998, and following the death of the Prince a few months later, the central government called for a gubernatorial election in Yogyakarta.
Sultan Hamengkubuwono X ran and was elected governor in October 1998, ushering in a new era in the history of the old sultanate.
Yogyakarta is still widely regarded as Kota Pelajar, a city for learning, where many go to study Indonesian languages, Javanese art and culture, its music and performing arts, as well as for higher education at Gajah Mada University, one of the country's top schools.
With the Sultan at the helm, the city of more than 380,000 was ranked "very high" on the Human Development Index, which measures life expectancy, education, and per capita income levels.
Its annual growth was more than 5 per cent in recent years.
A graduate in public administration from Gajah Mada University, the Sultan is known to be fiercely nationalistic and progressive.
His marriage to Queen Gusti Kanjeng Ratu Hemas, who bore him five daughters, ended the polygamist tradition of Javanese nobles.
A champion of women's rights, he hopes to see his eldest daughter, Princess Gusti Kanjeng Ratu Mangkubumi, succeed him as ruler and governor, against palace norms.
"In truth, I do not want to retire yet and so we have not talked about it," he said after his inauguration at the Istana in Jakarta. "But a governor is a public official... and that should not be restricted by gender."
Like her father, Princess Mangkubumi, 45, is active in empowering women in the remote villages. She is also a successful businesswoman, and chairs organisations such as the Yogyakarta Chamber of Commerce.
Last month, the Constitutional Court ruled in favour of a judicial review challenging the 2012 law, scrapping the patriarchal domination in the Yogyakarta sultanate.
The ruling would pave the way for Princess Mangkubumi to take over as governor when the time comes.
The 2012 law was enacted after a decade of talks between Yogyakarta and Jakarta to allow the Sultan to inherit the post of governor.
The judicial challenge against it was filed last year as a result of deep conflicts within the royal family.
It also came after a 2015 royal proclamation by the Sultan that named her as Crown Princess, even as detractors continued to argue that only a man could be ruler.
The princess, who was educated in Singapore, the United States and Australia, said she was glad to see the end of gender discrimination on the issue in Yogyakarta.
"The Constitutional Court ruling is not only for me," she said. "It is about being governor, and we should be just like any other province, where men and women are welcomed."
The Sultan is expected to spend his new term tightening legislation to ensure that Yogyakarta will have its first female ruler in more than 200 years, said political experts.
"The state shall treat men and women equally. It is in the Constitution...," he said. "Like it or not, the court's ruling must be accepted."