The 65-year-old writer, whose books have been adapted into both films and television series in Sweden and abroad, delivered the news in a post published on Wednesday on his official website and in the Göteborgs-Posten (GP) newspaper.
"My anxiety is very profound, although by and large, I can keep it under control," Mankell wrote.
He learned of the cancer two weeks ago following a trip to Stockholm for treatment for a slipped disc in his neck.
"When I went back to Gothenburg the following day I did it with a serious diagnosis of cancer," he continued.
"I do not have any particular memories of the journey back to Gothenburg. Only the stubborn gratitude that my wife, Eva, was with me."
A follow-up visit to Sahlgrenska University Hospital in Gothenburg revealed Mankell was suffering from "serious" cancer, with tumours in his neck and lung. Doctors said there was also a risk the cancer could spread elsewhere.
Following additional consultations with doctors, which are ongoing, he will decide upon a course of treatment.
In the meantime, however, Mankell remains committed to continuing what he's been best known for.
"At a very early stage I decided to try to write about this. I have decided to write just as it is," he wrote.
"But I will do it from the perspective of life, not death."
Mankell has written 12 books featuring Kurt Wallander, the dour detective based in the southern Swedish town of Ystad. He has also written numerous plays and children's books. In 1996, he was awarded the Astrid Lindgren Prize for excellence in children's writing.
In recent years, Mankell has also make headlines as a leftist activist who has been active in the Free Gaza movement.