A Danish hospital has released an image of a dying man being granted his final wish.

Carsten Flemming Hansen had been hospitalised at Aarhus University Hospital and was going to die of internal bleeding, after being too weak to undergo surgery on his stomach, ABC News reported.

Mr Hansen told his nurse Rikke Kvist of his final wish, which she went out of her way to grant.

"That was when I remembered that we are on the same floor that has access to a balcony," she told Danish news outlet Avisen.dk.

Mr Hansen's was wheeled in his hospital bed out to the balcony to enjoy the sunset on Tuesday evening before he died on Friday.

While smoking is not allowed at the hospital, staff made an exception.

The hospital has since shared the picture of Mr Hansen enjoying a final cigarette and a glass of wine .

"It was a very cozy and relaxed atmosphere," Ms Kvist said.

"Of course they were relatives also affected by the fact that he was going to die, and they were sad.

"But it was cozy and there was humour."

The photo has received more than 60,000 likes and 4000 shares on Facebook.

Newshub.