It was the murder that spawned a macabre YouTube sensation and threatened to ­topple Guatemala's government.

Hitmen shot dead Rodrigo Rosenberg, a lawyer, in Guatemala City soon after he recorded a sombre video blaming his imminent assassination on President Ålvaro Colom and other senior officials.

The 18-minute testimonial – which surfaced at the funeral – was uploaded to the internet and triggered a political hurricane in the central American country. Now, in a bizarre twist, it is alleged Rosenberg masterminded his own murder to frame the president. A UN investigation has concluded the lawyer, depressed over personal problems and angry with the government, sacrificed his own life in an elaborate sting.

"Who planned the act? We have to conclude that it was Rodrigo Rosenberg himself," Carlos Castresana, head of the UN commission, told a stunned country . "He decided to sacrifice his life in exchange for a change in the country. There can be no other explanation."

In a news conference the president, who faced protests and resignation calls, said he had been vindicated and that the country could move on.

Since May Rosenberg's video has been broadcast repeatedly on TV, sold on DVD, gone viral on YouTube and attracted so many online viewers some sites crashed.

The 47-year-old Harvard-educated lawyer, seated behind a desk and gazing at the camera, said: "If you are watching this message it is because I have been murdered by Alvaro Colom." He said his life was in danger over a corruption scam involving Colom, the president's wife and senior officials.

In a plot twist worthy of Agatha Christie investigators said Rosenberg made the recording knowing that two days later, on May 10, assassins he had hired would ambush him near his home. He was shot three times in the head, once in the neck and once in the back. He apparently hoped the video would render him a martyr.

After the video surfaced the International Commission Against Impunity in Guatemala, a UN panel set up to combat current organised crime and illegal

security groups, launched an investigation supported by local prosecutors.

It found that Rosenberg was distraught over an ugly divorce, the death of his mother and the murder of a client, Khalil Musa, and his daughter, Marjorie, who was Rosenberg's girlfriend. The lawyer blamed government officials for the double slaying, which he linked to a money laundering plot.

According to the investigation he asked two brothers, cousins of his first wife, to help him find a hitman, citing a problem with a supposed extortionist. Unknown to the cousins Rosenberg himself was the target. "They received his request and looked for someone capable," said Castresana.

Investigators said the brothers, Francisco and Estuardo Valdes Paiz, asked the head of security at their pharmaceutical company to find a hitman to do the job for $40,000. With one of the world's highest murder rates Guatemala has abundant assassins.

The commission head said Rosenberg bought two cellphones: one to communicate with his killers and another to leave threatening messages on his own personal phone. He apparently hoped the video would render him a martyr and open a Pandora's box which would topple the government.

Conservative foes of the leftist president did rally against Colom, whose main support is among indigenous Mayan poor, but he held on to power.

• This article was amended on Thursday 21 January 2010 to correct the mandate of the International Commission Against Impunity in Guatemala.