In September 2005, the Danish cartoonist Kurt Westergaard was asked by his newspaper, Jyllands-Posten, to draw the prophet Muhammad "as you see him". He did, and it changed his life. The resulting cartoon was deemed blasphemous by hardline Muslims around the world and drew death threats. More than four years later, after Westergaard had already been forced to spend a harrowing few months on the run with his wife Gitte, a 28-year-old man of Somali origin forced his way into their home last Friday evening wielding an axe and a knife.

At the time, Westergaard was looking after his five-year-old granddaughter, Stephanie. He was confronted with a terrible choice: risk being killed in front of his granddaughter, or trust that the PET, Denmark's security and intelligence service, knew what they were talking about when they had told him terrorists usually don't harm family members but stick to their target.

Westergaard chose to escape into his bathroom, which had been specially fortified as a "panic room", while Stephanie was left sitting in the living room. From the bathroom he alerted the police as his assailant reportedly battered the reinforced door with the axe, shouting, "We will get our revenge!"

"Those minutes were horrible," Westergaard recalled yesterday. "But I think I have got through this fairly well – and so, it seems, did my grandchild. That, of course, is the main thing. I would not have been able to live with myself if something had happened to her."

From the outside, Westergaard's house in Aarhus, Denmark's second-biggest city, looks like your average suburban home. But according to the cartoonist, it is a "fortress without a moat", equipped with security cameras and armoured windows. Living under the constant threat of revenge, he has always had to take precautions when leaving his home – visits to the gym, for example, could not be at predictable hours, so he would change his schedule every week. He carries a personal alarm and tracking device everywhere, and every day a police car would escort him to and from his work at Denmark's biggest-selling daily newspaper.

Westergaard had been one of 12 artists who agreed to the commission for Jyllands-Posten, but his drawing of a bearded man with a bomb in his turban became the most famous – or notorious. He says he didn't "necessarily" depict Muhammad; the bearded man might just as well have been a fundamentalist – a Taliban fighter, for example. Some of the other cartoons, meanwhile, clearly did not depict the prophet. But soon after 30 September 2005, when the 12 images appeared under the headline "The Face of Muhammad", they collectively became infamous as "the Muhammad cartoons".

Initially, reactions from the Muslim community were – for the most part – moderate. Three thousand Danish Muslims protested in Copenhagen, and Muslim organisations, politicians and ambassadors expressed their disapproval. Within months, however, things had turned violent. In February 2006, as he sat by his son's swimming pool in Florida, Westergaard heard that the Danish embassies in Damascus, Beirut and Teheran had been set on fire by protesters. His daughter-in-law turned white and begged him not to go home.

"At that point I realised that Denmark had lost its innocence," Westergaard told me last year. Despite his daughter-in-law's pleas, he went home as fast as he could, into a storm later described as Denmark's worst international crisis since the second world war.

But the true danger to Westergaard only became clear on 8 November 2007, more than two years after the publication of the cartoons, as he and Gitte were getting ready for a trip to Paris. They had already packed their suitcases – but they never left for France. Instead, the couple were urgently evacuated by the PET, who believed three men were planning to kill the cartoonist in his home.

What followed was not blue skies, dips in the sea and leisurely barbecues but cold, stress and loneliness in a "summerhouse odyssey", as Westergaard calls it. In all, they were forced to move nine times and drive nine different cars as they migrated from holiday cottage to holiday cottage on the outskirts of Aarhus, spending no longer than four weeks anywhere.

Isolated, missing his own bed and his books, Westergaard said of the time that, "If I had had a tendency to drink, I would have been drunk every single night." Gitte never blamed him, but at times the couple would snap at each other. "You feel locked up," he said. "Neither of us could predict how long we would have to stay, or what was going to happen."

With his red trousers, leather waistcoat, broad-brimmed black hat and giraffe-headed walking stick, Westergaard is not a man who easily blends into a crowd. At the Radisson SAS in Aarhus (sometimes a hotel room took the place of a holiday cottage), the Westergaards were asked to leave as their presence was considered a safety risk. At another hotel, while the couple were unloading luggage from their car, they came to the attention of two men and two women who were apparently of Middle Eastern origin.

"May you burn in hell!" one of the men shouted at Westergaard.

"Can we talk about it?" the cartoonist asked.

"May you burn in hell," the man repeated.

"Well, I guess we'll have to talk about it in hell, then," Westergaard finally said. When the police arrived five minutes later, the party of four was long gone.

On another night during their period in hiding, the phone rang in the cottage and an official told Gitte not to bother coming back to the kindergarten at which she worked. The sacking was swiftly reversed after the press heard of it and Aarhus's mayor intervened. For a while, though, Westergaard believed he and his wife were being "stigmatised by the surrounding society", as he puts it. It might have been irrational, he said, but "it is actually quite horrible".

The cartoonist says Friday's attack in his own home was his lowest moment since the cartoons were published. But he adds that smaller things get to him too, such as when a family member calls the intelligence service to ask if it is safe to invite him to a party. He wants to keep working – but right now he is back in a safe house and can't go to the office. He hopes they can work something out, but it depends on the security.

When I met Westergaard before this latest attack, there was a touch of melancholy in his eyes – but also anger and defiance. "I do not see myself as a particularly brave man," he said then. "If the country was occupied, I don't think I would be running around doing sabotage; I would probably be sitting somewhere doing my drawings. But in this situation I got angry. It is not right that you are threatened in your own country just for doing your job. That's an absurdity that I have actually benefited from, because it grants me a certain defiance and stubbornness. I won't stand for it. And that really reduces the fear a great deal."