David Bowie kept his illness a closely-guarded secret from the world, his friend Ricky Gervais has said, revealing that he was in contact with the late singer as little as two weeks before the end of his life earlier this year.

The iconic pop star lived with cancer for 18 months before his death on January 10th this year, but he kept his illness private from all but a very small handful of family and those closest to him. His passing came as a huge surprise to virtually the entire world, and prompted a massive outpouring of grief and tributes throughout the music industry and beyond.

David BowieDavid Bowie

British comedian Gervais, speaking to BBC Radio 5Live’s Afternoon Edition on Monday (April 25th), said that he had been e-mail communication with Bowie just a fortnight before his death to tell him how much he had enjoyed his final album Blackstar, and that his messages back contained no indication of his illness, or any negative mindset at all.

“[His death] was a total surprise. I was emailing him two weeks before, so he must have known… He kept it from everyone,” 54 year old Gervais said of his communication with Bowie. “What dignity. He was an amazing man. It was something for him and his family. Dignity to the end.”

More: Iman reveals how her long-lasting marriage to David Bowie kept strong over 24 years

The pair had struck up a friendship more than a decade ago, with Bowie memorably appearing as himself in Gervais’ comedy series ‘Extras’ in 2006. The two of them spent time together in both Britain and New York. “He was a fan of comedy. It's funny that I was a failed pop star and he loved comedy,” he remarked.

“I got an email from him saying ‘I watch ‘The Office’, I laughed, what do I do now?’… We sort of became pen pals,” Gervais remembered about how they first met.

Ricky GervaisGervais was being interviewed about his new Netflix project 'Special Correspondents'

Gervais was being interviewed about his new Netflix comedy movie Special Correspondents, released on Friday (April 29th), in which he stars alongside Eric Bana as two journalists who fake their own kidnapping to create a story. The comedian’s relationship with the TV streaming company has been high-profile over the last few years, and he explained why he had chosen to work with them over the traditional networks.

“I've avoided doing a network comedy, because I wouldn't get my own way. Even though it would get more viewers it wouldn't be mine. And then Netflix come along and say you can still get your own way and the sky's the limit for ratings. They have 75 million subscribers now.”

More: David Bowie’s ‘Blackstar’ revealed as highest-selling vinyl album of the last 12 months