Fredrik Reinfeldt, the Swedish prime minister, was not present but sources say dead man was a 'familiar face' in the building

A security guard working for Sweden's prime minister, Fredrik Reinfeldt, has died in a shooting incident inside the prime minister's heavily protected official residence, police in Stockholm said on Friday.

Detectives said no crime was suspected and it is unclear whether the shooting was an accident or suicide. Reinfeldt was not there at the time, but government sources said one of the prime minister's two teenage sons was in the building when the weapon was fired.

"The Swedish PM and his family are fine. The prime minister was at a meeting in Stockholm. He wasn't in the building," Markus Friberg, Reinfeldt's press secretary said.

Security for top politicians in Sweden has been a major concern since the unsolved murder in 1986 of Sweden's Social Democrat prime minister Olof Palme, and the murder in 2003 of the country's foreign minister Anna Lindh. Lindh was shopping in a Stockholm department store without bodyguards when an assailant, Mijailo Mijailović, stabbed her several times. She died in hospital.

Following security advice, Reinfeldt lives in a closely guarded official residence in central Stockholm. The immediate area around the building is closed to the public and the prime minister has two personal bodyguards at all times. Security was tightened last summer following the attack and mass shooting by the neo-Nazi Anders Behring Breivik in Norway.

Swedish government sources said on Friday that the dead man was not a bodyguard but had worked as a security guard in the building for a long time and was a "familiar face". "Many people knew him. We don't yet know whether the shooting was suicide or a mistake," Mats J Larsson, a reporter with the Swedish morning paper Dagens Nyheters, said from the scene.

Larsson said police were talking to the prime minister's son in an attempt to establish what happened. Reinfeldt recently separated from his wife; his children – two sons aged 18 and 16, and a daughter – are frequent visitors. It is unclear where inside the building the shooting took place. The body was removed on Friday afternoon.

The incident took place at 1.10pm local time when Reinfeldt was half a mile away, on a visit to the newsroom of Sweden's evening Aftonbladet newspaper. The prime minister had been holding a meeting with the paper's board and had also toured the newsdesk.

Police began a major security operation and emergency services rushed to the official residence, Sagerska Palatset, in the centre of the Swedish capital. "There are three Swat teams, a police car and an operation leader here. They are not allowed to say anything. Two civilian policemen with bulletproof vests are in the building," Aftonbladet reported.

"I can say nothing happened to the prime minister. He was not harmed," Stockholm police spokesman Lars Bystrom said. "And it wasn't one of his bodyguards but some security guard. We do not suspect any crime."