COPENHAGEN, Denmark (AP) -- 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.

"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."

King Carl XVI Gustaf in neighboring Sweden expressed his condolences on Instagram, adding "we will remember Prince Henrik with great warmth."

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 anecdotes about Henrik's life.

The royal household on Wednesday announced a month of mourning during which royals will wear dark clothing and not participate in social events. It also said military staff would wear black arm bands.

Hundreds of Danes wrote on the royal household's Facebook page, to express their condolences.

Danes can bid farewell to the prince on Saturday at the chapel of the downtown Christiansborg Palace, where his casket will be on display. A funeral would be held Tuesday Feb. 20 at the building, which houses Parliament and the prime minister's office and is also used for royal ceremonies.

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.

The palace said it would respect Henrik's wish to be cremated, with half his ashes spread over Danish seas and the other half buried in the royal family's private garden at the Fredensborg Palace, north of Copenhagen, where he died.

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 Crown Prince 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.

On Friday, the royal palace said his condition had "seriously worsened" and Frederik rushed home from Pyeongchang, where he was a member of International Olympic Committee, before the official opening of the Winter Games.

Henrik is survived by his wife, sons Crown Prince Frederik and Prince Joachim, and eight grandchildren.