COPENHAGEN, Denmark -- Prince Henrik, the French-born husband of Danish monarch Queen Margrethe who publicly vented his frustration at not being the social equal of his wife or their son in line to become Denmark's king, died late Tuesday. He was 83.

He was diagnosed with dementia last year and was hospitalized late last month with a lung infection. Earlier in the day, Henrik was moved from a Copenhagen hospital to the family's residence north of the capital, where the royal palace said he wished "to spend his last moments."

A later statement said Henrik died at 11:18 p.m. in his sleep and that the queen and their two sons were at his side.

Get Breaking News Delivered to Your Inbox

"The royal family has lost an anchor," Prime Minister Lars Loekke Rasmussen said in a statement, who said Henrik "kept his good spirits till the end."

Prince Henrik of Denmark seen in his vineyards around Caix Castle, in Caix, Cahors region, southwestern France, on September 24, 2009. AP

Flags were at half-mast on public and private buildings across Copenhagen, including the city's famed downtown amusement park Tivoli. National radio channels changed their morning programs to broadcast more austere music interrupted by titbits and anecdotes about Henrik's life.

Crown Prince Frederik, an International Olympic Committee member, had left Pyeongchang before the official opening of the Winter Games to rush home because of his father's worsening condition. During Henrik's final illness, Danes wrote on the royal household's Facebook page, offering warm thoughts to his family.

The Danish royal family has no political authority, but is one of the world's oldest kingdoms and prides itself on stability. Henrik, however, caused a scandal last August by announcing that when he died he didn't want to be buried next to Margrethe in the cathedral where the remains of Danish royals have gone for centuries. The queen already had a specially designed sarcophagus waiting for the couple.

Born on June 11, 1934, in southwestern France to parents with the noble titles of count and countess, Henri Marie Jean Andre de Laborde de Monpezat married Denmark's future queen in 1967.

Henri became Henrik and converted to Denmark's state Lutheran Church. However, he found it difficult to fit in with Denmark's egalitarian lifestyle.

He was titled prince consort - the husband of a reigning queen but not a king - and he wasn't in the line of succession - his oldest son Frederik being the heir.

Shortly after the royal marriage, media criticized Henrik because he had openly aired his views that spanking was good for children. In the mid-1980s, Henrik publicly said he wanted a paycheck instead of relying on the queen, who gets annual allowances.

The law was eventually changed to give him roughly 10 percent of the annual allocation Parliament makes to royals each year.

In a 2002 interview, Henrik again stunned Danes by saying he felt he had been pushed aside in his own home, not only by his wife but also by his son. This followed the annual royal New Year's reception for foreign diplomats, where Frederik had been host because his mother was unavailable due to a broken rib.

"For many years I have been No. 2," Henrik told Danish tabloid B.T. "I have been satisfied with that role, but after so many years in Denmark I don't suddenly want to become number three and become some kind of wearisome attachment."

Henrik lived his first five years in France's Asian colonies. He graduated from universities in Paris, learned Mandarin and Vietnamese and spent a year at the Hong Kong University from 1958-1959.

After his move to Denmark, Henrik, a keen pianist, was active in different organizations and wrote poetry, memoirs and books, including a coffee table book on French gastronomy in 1999.

Margrethe and Henrik also owned a chateau in southwestern France where they retreated every summer.

Under Denmark's Constitution, the royal family has no political power and is barred from involvement in party politics. As a royal, Henrik held honorary ranks of general in the Danish army and air force, and was an admiral in the navy.

Mette Jensen, a 33-year-old office clerk, said that while the Danes had a "love-hate" relationship with Henrik, "I think we will miss him."

In September 2017, the palace announced that Henrik had undergone tests at Copenhagen's university hospital. The diagnosis was dementia and "the extent of the cognitive failure is greater than expected," the palace said.

In January, he was admitted to a hospital with a lung infection and later was said to have a benign tumor.