Prince Henrik of Denmark, the husband of Queen Margrethe, has died at the age of 83, the Royal House has announced.
The prince died "peacefully in his sleep" at Fredensborg Castle, north of Copenhagen, it said. Queen Margrethe and their two sons were at his side.
The French-born prince had been transferred from hospital to the castle to spend his final days there.
He was admitted to hospital late last month with a lung infection, and was diagnosed with dementia in 2017.
Prince Henrik was born Henri Marie Jean André de Laborde de Monpezat in 1934, and married the then-crown princess Margrethe in 1967.
She became queen in 1972 and over the years Prince Henrik made no secret that he was unhappy at being named as prince rather than king.
He spoke with a thick French accent, and was known for his love of food, wine and poetry.
In 2016, he retired from official duties, renouncing the title of Prince Consort. In the time since, he was often in France at his private vineyard.
Royal officials said last year that he had decided not to be buried next to Queen Margrethe because of his unhappiness at never being designated her equal.
The queen, 77, is said to have accepted her husband's decision, which broke a 459-year-old tradition.
Prince Henrik and Queen Margrethe have two sons - Crown Prince Frederick and Prince Joachim.
Crown Prince Frederick returned from the Winter Olympics in Pyeongchang, South Korea last week to be with his ailing father.