The Queen and husband Prince Philip attend Royal Ascot in June 2014. [Courtesy]

The Queen was at Prince Philip's bedside when he died at Windsor Castle and he spent his final days insisting on looking after himself, it is reported.

The Duke of Edinburgh is said to have refused to go back to hospital before he died "peacefully" in his sleep in his private apartment on Friday morning, just two months before his 100th birthday.

Britain's longest-serving consort was discharged from a London hospital on March 16 after a month-long stay in which he underwent heart surgery and was treated for an infection.

It is said that he spent his final days with the Queen, 94, and his frail condition worsened overnight on Thursday, but the suggestion of taking him back to hospital was quickly dismissed by his wife.

Insiders told the Telegraph that Philip became "gravely ill" and was determined to die at home in Berkshire.

A source said: "He spent most of the four weeks he was in hospital trying to get home. They operated on his heart in a bid to give him a little longer, maybe with the 100th birthday in mind.

"But he didn't really care about that. He just wanted to be back in his own bed.

"There is no way he would have wanted to die in hospital."

Sources said the duke had been able to see his four children - Prince Charles, Princess Anne, Prince Andrew and Prince Edward - in separate "super-distanced" meetings before his death thanks to all of them receiving a coronavirus vaccine.

But he was unable to see his grandchildren, including Prince William, and great-grandchildren, as they have not been vaccinated, sources added.

It is said the duke was frustrated by Covid restrictions which limited family visits and made nursing visits harder.

He was reportedly in "good form" just days before his death, spending his final days with his beloved wife 'Lilibet'.

Earlier this week he was still reading and writing letters, and speaking to loved ones on the phone as he was not a fan of using Zoom, which he had used to stay in touch with grandson Prince Harry.

Sources told the Daily Mail that since his return from hospital the 99-year-old had been "calmer and quieter", and was largely confined to his room.

He kept two framed photos by his bedside - one of his wife and one of his mother, it is claimed.

He was determined to the end that he would die in his own home, and mealtimes were changed so he could dine with the monarch whenever he felt well enough.

The Queen was heard saying that the duke refused to wear his hearing aid, and he declined to have a staff member pick up his glasses when he dropped them, doing it himself, it was reported.

Insiders claim he cancelled his 7.30am morning tea which would be delivered by a valet, and he had little appetite for the food sent up on a tray.

When he felt well enough he would sit in the sunshine with a blanket over his legs, after leaving his room dressed in a shirt and jumper, freshly pressed trousers and shoes.

With walking increasingly difficult, Prince Philip would use a stick, resisting a wheelchair when aides suggested it.

He would reportedly say: "Get that bloody thing out of my sight!"

An insider said: "When he came back to Windsor he said he was not going back to any hospital.

"No fuss was the constant refrain."

Details of the Duke of Edinburgh’s funeral are expected to be released this weekend.

Prince Philip leaves King Edward VII's Hospital on March 16, the last time he was seen in public [Image: AFP via Getty Images]

Buckingham Palace said Philip died peacefully in his sleep at Windsor Castle, leaving the Queen and the royal family “mourning his loss”.

His death triggered a flood of tributes from across the globe – with world leaders, foreign royal families and charities hailing his life and legacy.

Philip’s funeral is expected to take place at St George’s Chapel in Windsor, but the ongoing Covid-19 lockdown in England will impact plans.