Rodrigo Rosenberg lived alone in an apartment in Guatemala City's trendy Districto 14, a refuge for diplomats and heirs to 19th-century fortunes. Miserable and divorced, the balding 47-year-old lawyer was estranged from his children, who lived in Mexico with his ex-wife. Rosenberg's bodyguard was the closest thing to a roommate, his abandoned bicycle on the terrace the closest thing to exercise.

On 10 May last year, he left his home at 8am. Security cameras would later show him mounting a bicycle and ­riding away, alone, on a two-lane, tree-lined street. The morning traffic was minimal as the assassins moved in. More camera footage shows a souped-up Mazda shadowing Rosenberg. The killing is over in seconds. The Mazda speeds away, and Rosenberg bleeds to death on the street. The Harvard-educated lawyer had been shot three times in the head.

The killing was horribly typical of Guatemala City, rated the third most dangerous city in the world, where an estimated 98% of murders are never solved. According to a 2007 UN report by human rights scholar Philip Alston: "Guatemala is a good place to kill."

But at the end of Rosenberg's funeral the following day, Luis Mendizábal, a close friend, handed out a video to mourners. It was a filmed statement by Rosenberg made just four days earlier. The video, a simple amateur recording, showed Rosenberg behind a desk in a plain blue blazer and tie. But his ­message sent reverberations through the country's political landscape.

"If you are listening to this," said the dead man, "it's because I was murdered by President Alvaro Colom, with the help of [the president's private secretary] Gustavo Alejos and [businessman] Gregorio Valdez."

Rosenberg's video also alleged corruption at the highest levels of BanRural, a government-run co-operative bank. "The last thing I wanted was to deliver this message, knowing that if you're watching it, it's because I'm dead, because this won't make my children any better. But I hope Guatemala will be better. I hope my death helps get the country started down a new path. Guatemalans, the time has come."

Within hours of the funeral, the 17-minute video had been uploaded to a Guatemalan newspaper website and YouTube. Within Guatemala it went viral, and crashed servers. Hundreds of thousands of viewers worldwide watched the chillingly calm lawyer ­predicting his own death, and ­apparently naming his murderer.

As technicians struggled to amp up the available bandwith, politicians surged into action. With corruption endemic in Guatemala, the murder of Rosenberg became a rallying cry for conservative opponents of the progressive Colom administration. Frustration at widespread immunity for criminals boiled over into public demonstrations, where tens of thousands of upper-class, anti-government protesters donned white shirts in a symbolic statement against dirty politics as they clamoured for the president to resign.

Meanwhile supporters of President Colom, who came to power in 2007, immediately called the whole episode a sick rightwing plot to quash the president's call for raising business taxes and providing fairer treatment for the country's Mayan majority. "Nobody could figure out what was happening," said Fernando Barillas, then the president's spokesman and top aide, as he described the Colom administration's reaction to the video. "We were discusing the H1N1 [swine flu] virus and whether this was a national epidemic or not . . . Then you have this recording where someone – before they die – accuses the president of his death? It was like something out of a novel or a movie script."

But among the ruling elite, a consensus was boiling up: the president had organised the hit, so the president must go. Colom's bumbling interview with Patricia Janiot on CNN, and his ­refusal to immediately address the charges, added to the conclusion that the end of his reign was imminent.

For a tense two weeks, Colom's ­tenure was in serious doubt. Protests both for and against filled the plazas of Guatemala city. Had George Bush still been in power in the US, the leftist Colom might well have been dumped, but in a quiet victory for Obama-style diplomacy, a delegation from the US-dominated Organization of American States was sent to Guatemala to provide full US-backing for Colom's administration, which nonetheless was almost washed away by a Twitter and Facebook-led wave of criticism.

In the eight months since the ­killing, amid all the feverish ­speculation ­endemic to Guatemalan life, two ­favoured scenarios emerged: ­Rosenberg was murdered either because he got too close to dirty deals himself, or by rightwing activists in a plot to frame President Colom. The truth, however, which emerged only this week, is even more bizarre and shocking. Rosenberg planned his own suicide, then tried to pin it on the president.

"Nobody else but him is responsible for his own death," Carlos Castresana, leader of the UN's investigation into the killing, told a stunned press conference in Guatemala City on Tuesday. "He planned it all."

Rosenberg's entire script, said ­Castresana, was fiction – a twisted plot hatched by the lawyer to upend Colom's presidency. It was apparently Rosenberg himself who asked distant relatives of his ex-wife for help. "These are very close friends, to whom he says: 'I have a swindler who is threatening me, and I want him dead.' They receive the ­mission and look for someone capable of doing it."

Rosenberg also negotiated the ­specifics of the hit, and even provided the mobile phones used to negotiate the fee, which was set at 300,000 ­Quetzal [£22,000]. Once the execution was ­arranged, Rosenberg had one last detail to sort – he told his driver to fix up his long-abandoned bicycle.

Until April last year, Rosenberg was a low-profile lawyer with a low-profile life. But that world was shattered when a pair of assassins on a red ­motorcycle unleashed a volley of ­bullets at 74-year-old ­industrialist ­Khalil Musa, one of ­Rosenberg's ­clients, as his daughter Marjorie drove him away from his Guatemala City ­office. Musa was hit six times, the ­bullets splintering his body. One passed through him and killed his daughter instantly.

The murders made few headlines, even though they were carried out in broad daylight and Musa was a well-known businessman. But to Rosenberg, the death of Marjorie Musa was devastating. As emails and text ­messages uncovered by the UN ­investigation would determine, ­Marjorie, who was married, and Rosenberg, a divorcee, were having an affair.

The distraught Rosenberg became obsessed with solving the Musa murders – and linking them to what he believed was a corruption scam reaching to the highest level of government; all the way to President Colom and his wife Sandra, who regularly infuriated Guatemala's ruling class by appearing on TV handing out food and healthcare to the poor. The first lady adamantly refused to have her social programmes audited, leading to widespread rumours that millions were being skimmed off by corrupt officials.

As a top corporate lawyer in Guatemala, Rosenberg was well versed in the incestuous relationships that dominate the country's corporate-government relationships. And he had the means to investigate them – friends in government and industry, his own law firm. He began telling close friends that he was now immersed in a Bond-like world where informants passed on secret documents and called him to clandestine, Deep Throat-style meetings. Death threats, he calmly explained, were now commonplace. He even provided his friends with the mobile numbers from which those threats originated.

"Rosenberg felt guilty about the ­assassination of [Marjorie] Musa," said Castresana at the press conference. "He began a desperate search all over to find Musa's killers . . . but he found no proof."

Instead, he began to fabricate evidence and incidents to bolster claims that he had uncovered a massive government corruption scandal. He sent his bodyguard to buy two mobiles – one to make death threats to himelf, the other for the hitmen to broker the assassination of the imaginary "swindler". And then, after making the video, Rosenberg placed several calls to friends, took out his mended bike, and rode to the designated kill zone on 2da Avenue. Then he sat down, waiting for the killers to arrive.

But amid all the careful plotting, Rosenberg made one critical miscalculation. No other square block of Guatemala City has more security cameras than the murder site, on account of all its rich residents. Recording from various angles, these cameras captured the getaway Mazda, which in turn led to the assassins. And after months in jail, they finally began to collaborate, helping Castresana to unravel the truth of this extraordinary crime.

Instead of being toppled by the ­bogus video, Colom now appears to have emerged as a stoic leader who did not cave in to populist sentiment. Whereas Rosenberg, once widely ­regarded as a patriotic hero who died for his nation, leaves a legacy of betrayal that is likely to put some of his associates in prison for decades.

"The crimes that happen here are unthinkable in other parts of the world and rival any political thriller," concludes Simon Granovsky-Larsen, an author who is a leading expert on political violence in Guatemala. "In the first months, or even years, after a political crime like Rosenberg's, it is difficult to know what is a crazy conspiracy theory – and then one of those crazy conspiracy theories turns out to be true. In other parts of the world, this could only be fiction."