The disgraced son of Norway’s new queen will be allowed to leave house arrest despite a recent rape conviction so that he can attend the funeral of the late King Harald V.

King Harald died on Friday at the age of 89.

His son, the Crown Prince, immediately became King Haakon VIII. King Haakon’s wife, who has had a troubled time in recent years, became Queen Mette-Marit.

Her son, Marius Borg Hoiby, who was born from a relationship before she married King Haakon, was sentenced in June to four years in prison after being found guilty of committing two rapes.

He is serving his sentence under house arrest with an ankle tag while awaiting a new trial after he appealed against the conviction.

Norwegian police said on Monday that Hoiby would be allowed to leave house arrest to go to the funeral of the late king on Sept 9.

Marius Borg Hoiby

Marius Borg Hoiby was sentenced to four years in prison for two counts of rape, a conviction he is appealing – HAKON MOSVOLD LARSEN/AFP via Getty Images

Hoiby was previously granted permission to visit King Harald in hospital before his death last week.

“The public prosecutor deemed that there were grounds to grant the requests for leave submitted by Hoiby in connection with the death,” said Oda Karterud, a police prosecutor. “Leave has been granted.”

In addition to the two counts of rape, Hoiby was convicted of 32 other charges, including violence towards a former partner. He was acquitted of two other rapes.

The 29-year-old was also allowed to attend the transfer of the king’s coffin through the royal palace to the palace chapel on Monday.

Marius Borg Hoiby during the first day of the trial against Hoib

Hoiby’s trial severely damaged the Norwegian royal family’s reputation – OLE BERG-RUSTEN/NTB/AFP via Getty Images

His mother, the new queen, joined the procession, making her first official appearance since assuming the title.

King Haakon will take the oath to Norway’s constitution on Tuesday.

Among the challenges he faces will be repairing the image of the monarchy in the wake of his wife’s past association with Jeffrey Epstein, the paedophile financier, and the rape conviction of his stepson.

Queen Mette-Marit has been largely absent from the public eye in the wake of a lung transplant she underwent in June. She was diagnosed in 2018 with pulmonary fibrosis, a progressive disease that damages and scars lung tissue.

Norway's King Harald's coffin is carried at the Royal Palace in Oslo, Norway

A national period of mourning has been declared in Norway after King Harald’s death – Stian Lysberg Solum/NTB

Norwegians paid tribute to the late king over the weekend, laying flowers, writing cards and lighting candles in front of the royal palace in Oslo, where the coffin arrived on Friday from the hospital.

Tens of thousands of people attended memorial services in churches and cathedrals across the country.

As Crown Princess, Mette-Marit apologised earlier this year for her friendship with Epstein and said she had been “manipulated” by the disgraced financier and sex offender.

She said she had no idea that Epstein was a predatory abuser of teenage girls and young women, insisting that she never witnessed anything illegal.

The close friendship between the two was revealed in the Epstein files, released by the US Department of Justice.

King Harald had been in hospital in Oslo since mid-August, suffering from haemolytic anaemia, a condition caused by an abnormally rapid destruction of red blood cells that leads to fatigue and shortness of breath.

He faced mounting health problems in his final years and scaled back his official duties.

Try full access to The Telegraph free today. Unlock their award-winning website and essential news app, plus useful tools and expert guides for your money, health and holidays.