Palace sources said he was “calmer and quieter” during his last days at Windsor Castle and spent his time reading in the sun, writing letters and talking to loved ones on the phone.
He was said to be frustrated by Covid restrictions, which made family visits harder, but he was pleased to be back home.
One well-placed source told the Telegraph: “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.”
Insiders said the duke tried to stay as independent as possible, despite his deteriorating health, and continued to dress himself.
He became furious when a wheelchair was placed in his room, demanding staff “get that bl***y thing out of my sight”.
On one occasion he dropped his glasses and refused to let aide pick them up, insisting on doing it himself.
In the days prior to his death the duke had little appetite but mealtimes were changed so he could dine with the Queen when he felt well enough.
Sources said Prince Philip’s decline was gradual before he became “gravely ill” on Thursday night.
The Queen dismissed any suggestion that he would return to hospital and was by his side when he passed away on Friday morning.
Buckingham Palace released a statement at midday confirming the duke’s death.
“It is with deep sorrow that Her Majesty The Queen has announced the death of her beloved husband, His Royal Highness The Prince Philip, Duke of Edinburgh,” it said.
“His Royal Highness passed away peacefully this morning at Windsor Castle.
“Further announcements will made in due course.
“The Royal Family join with people around the world in mourning his loss.”
Prince Philip was married to Queen Elizabeth for 73 years and is the longest royal consort in history.