Scottish author unlikely to live longer than a year and latest novel The Quarry set to be his last, he revealed on his website

Iain Banks, whose darkly humorous presence has enlivened Scottish literature for 30 years, has announced he is "officially very poorly" with gall bladder cancer and may have only months to live.

Banks, 59, is recovering from jaundice caused by a blocked bile duct. "But that – it turns out – is the least of my problems," he said on his website.

The author's trademark deadpan humour was to the fore as he broke the news: "I've withdrawn from all planned public engagements and I've asked my partner Adele if she will do me the honour of becoming my widow (sorry – but we find ghoulish humour helps)," he wrote.

His website soon broke under pressure from wellwishers who wanted to read the news and leave tributes.

Banks has delighted fans with his prolific output under two names, and outraged literary puritans with his blithe assertion that he aimed to devote no more than three months a year to writing, because there were so many more interesting things to do – like driving fast cars and playing with fancy technology.

So it must have seemed a very black joke indeed when he discovered a back problem he had ascribed "to the fact I'd started writing at the beginning of [January] and so was crouched over a keyboard all day" was something much more serious.

"When it hadn't gone away by mid-February, I went to my GP, who spotted that I had jaundice. Blood tests, an ultrasound scan and then a CT scan revealed the full extent of the grisly truth by the start of March," he wrote.

"I have cancer. It started in my gall bladder, has infected both lobes of my liver and probably also my pancreas and some lymph nodes, plus one tumour is massed around a group of major blood vessels in the same volume, effectively ruling out any chance of surgery to remove the tumours either in the short or long term."

He said he and his new wife intend "to spend however much quality time I have left seeing friends and relations and visiting places that have meant a lot to us".

His publishers, meanwhile, are doing all they can to bring forward the publication date of his new novel, The Quarry, "by as much as four months, to give me a better chance of being around when it hits the shelves".

Banks, who made his literary debut in 1984 with The Wasp Factory, is really two authors: he writes bestselling, mainstream, literary fiction as Iain Banks, and award-winning science fiction as Iain M Banks, about the Culture universe.

Last summer he described his development as a writer in a typically jocular column for the Guardian Review book club, which featured the first of his Culture novels, Use of Weapons. "The original draft … dates from 1974 and was packed with purple prose of the look-I've-got-a-thesaurus-and-I'm-going-to-use-it/never-use-one-adjective-when-six-will-do school. (Oh, I should add that, having written three unpublished novels by this time, one of them immensely long, and a 30,000-word novella, I must have decided that writing one book at a time was somehow too easy, so when I started writing UoW I started another novel at the same time.)"

His happy-go-lucky front conceals a stubborn streak, which he also revealed in the column, recalling how he had initially ignored the advice of two mentors – science fiction writer Ken MacLeod and publisher James Hale – as to how to liberate the novel from its "manically complicated structure that was really only comprehensible with a diagram". Having initially told both men "they were mad", he eventually realised they might have a point. "As a result, what may still be my best SF novel is largely the work of others."

MacLeod, the award-winning Scottish science fiction author, who is a friend of Banks from high school days, said the support went both ways. "It's very hard to take. Iain has been a tremendous support and encouragement over the years. You couldn't ask for a better friend, and I'm just holding out for a statistically improbable recovery."

Banks said he was still deciding whether to undergo chemotherapy "to extend the amount of time available". He told friends and colleagues about his cancer diagnosis a few weeks ago

"The way Iain has reacted to his situation is not really with a sense of unfairness but more that it's just the way the universe works, the way matter works, that there's nobody out to get us, nobody to blame for it all," said MacLeod. "It's a very courageous and stoical attitude in his situation. There's no doubting the style of the man. What you see is what you get, and the Iain who comes across in his books is very much how he is."

MacLeod said Banks thought of himself as principally a science fiction writer who happened to have published a literary novel first. "He wrote several of the Culture novels in first drafts before The Wasp Factory and he got many rejections. He was almost embarrassed when he wrote a mainstream novel in The Wasp Factory and wondered if his friends would think he was selling out."

Banks's friend Ian Rankin, creator of the archetypal Scottish detective Inspector Rebus, said he preferred the literary novels to what Banks called his "skiffy" [sci-fi] books. "The exciting thing about reading Iain Banks is that you never know what kind of book it's going to be.

"It could be weird, it could be other-worldly, it could be literary fiction, a family saga, about a disc jockey – you don't know what you're going to get, so every time a new book comes out there was that excitement."

Rankin said he and Banks were part of a group of writers who would get together "fairly regularly, either for a few beers in Edinburgh, or a curry."

"He has this huge belly laugh with his head thrown back … He's a really interesting guy to spend time with – a mind fizzing with energy and ideas, with a childlike wonder at the world. He's also quite engaged with politics – I remember him destroying his passport in protest at what he saw as Tony Blair's warmongering, and then suddenly realising he needed it for a tour to Australia. He wears his politics and his passion on his sleeve, and he's full of quirks – really engaging quirks. He was attempting at one point to drive along every single road in Scotland, for example, keeping very detailed road maps."

Rankin said Banks's comment about asking Adele if she would do him the honour of "becoming my widow" was typical of the author.

"That combination of the macabre with the comedic is something he pulled off time and again in his fiction," said Rankin. "He's taken it with good grace and humour and stoicism. I hope I have the chance to have that drink with him in Edinburgh."

Banks wrote an exploration of the history of malt whisky, Raw Spirit, which gave him an excuse to expound his political beliefs. He began his journey, shortly after Iraq had been invaded, in a car festooned with anti-war posters. Given its timing, he wrote, the book "can't help being about the war", but then whisky had always been "up to its pretty bottle neck" in politics.

These days, Banks flaunts his political views with a FTT (Fuck the Tories ) T-shirt. But a courteous side was shown in his statement that the treatment he had received from the NHS in Scotland had been "exemplary, and the standard of care deeply impressive. We're all just sorry the outcome hasn't been more cheerful."

"It's very moving indeed how many people are very sad," said MacLeod. "Everybody who knows him is just devastated by this."

Banks's statement was reposted on a new website called Banksophilia: Friends of Iain Banks, which has been set up for friends, family and fans to leave messages and check his progress.