On Tuesday, former Malaysian Prime Minister Najib Razak will appear in court, facing years in prison on corruption charges which seemed impossible less than a year ago.

The son and nephew of former prime ministers, scion of the Malay elite, and head of the all powerful United Malays National Organization (UMNO), which has dominated Malaysian politics since the country's independence, Najib's downfall is as staggering as the scale of the corruption he has been accused of.

Even after the scandal over 1MDB -- sovereign wealth fund Najib set up and allegedly helped embezzle billions of dollars from -- erupted worldwide, sinking Malaysia's credit rating, splashing across front pages, and sparking investigations in the US, Switzerland and Singapore, the idea of Malaysia prosecuting its leader still seemed like fantasy. Najib was the "Teflon prime minister," and almost all observers expected him to weather the storm, or bring Malaysia down with him.

For Clare Rewcastle-Brown, the journalist who broke the 1MDB story for her publication Sarawak Report, the entire affair felt "slightly surreal."

She kept expecting Najib to find a way out of it, wondering what the "remnants of old Malaysia," the ruling class that still dominates the country, would "manage to pull out of a hat."

Indeed, Najib defied so many attempts to bring him down that it seemed for a long time like he might hang on despite everything. That he didn't is a testament both to the power of journalism and voters to effect change, as well as the alleged hubris of a leader who misjudged the willingness of even a notoriously corrupt elite to tolerate graft and scandal on the scale of 1MDB.

Political son

Najib Razak grew up accustomed to privilege and power. The son of Prime Minister Abdul Razak Hussein, he attended the elite Malvern College in the UK, from the ages of 15 to 18, before going on to study economics at the University of Nottingham, an education which reportedly left him with a pronounced British accent some observers felt could hold him back in politics.

After a brief stint as an executive at the state-run oil company, Petronas, Najib entered politics aged just 23, taking over the Pekan parliamentary seat occupied by his father, after the older man's death in 1976. He quickly rose through the ranks of UMNO, the largest party in the ruling Barisan Nasional coalition set up by Abdul. Between 1976 and 1999, Najib held finance, culture, education and defense portfolios, overseeing in the latter role a significant investment in and modernization of Malaysia's armed forces.

While he may have earned the seat through political pedigree, Najib proved an adept electoral operator, winning majorities of 23,000 and 26,000 in 2004 and 2008 respectively, among the highest margins in Malaysian history. In 2009, his rapid climb reached the pinnacle of the country's politics, as he succeeded Abdullah Ahmad Badawi as both UMNO leader and Prime Minister. While UMNO had previously succeeded in appealing to ethnic Malays, at the expense of Chinese and Indian voters, Najib emphasized a "multiracial, multi religious" nation under the banner of 1Malaysia.

A key part of this approach was the 1Malaysia Development Berhad (1MDB) sovereign wealth fund, which Najib and others said would be instrumental in "propelling Malaysia towards becoming a developed nation."

According to prosecutors in Malaysia, the US and Singapore however, 1MDB swiftly became a slush fund for its executives, including Najib, who allegedly used it to pay for his and his wife's increasingly extravagant lifestyles, as well as for vote-getting projects in parts of the country where UMNO support was flagging.

Scoops and scandal

In early 2015, Rewcastle-Brown and the Wall Street Journal, both of which had received leaked documents relating to 1MDB, began reporting that millions of dollars had been siphoned off the fund, with large amounts ending up in the accounts of Najib and his associates.

At first, it seemed like the scandal might spell the end of Najib, as opponents, and even some within his party, demanded an investigation and called for him to resign. While he denied any wrongdoing, Najib ordered an investigation into the fund, and the country's attorney general opened a case.

Behind the scenes however, Najib and his allies were moving quickly to put a stop to the scandal. Xavier Justo, a former employee of the 1MDB-linked PetroSaudi, who allegedly attempted to blackmail that company with stolen documents before leaking them to journalists, was arrested in Thailand.

Facing years in a Thai jail, Justo was allegedly pressured to claim Rewcastle-Brown's Sarawak Report and The Edge, a Malaysian newspaper which had been leading the story domestically, of fabricating and doctoring the leaked documents.

The cascade of negative stories continued however, and in July 2015, Najib took to Facebook to defend himself.

"Let me be very clear: I have never taken funds for personal gain as alleged by my political opponents -- whether from 1MDB, SRC International or other entities, as these companies have confirmed," he wrote. "It is now clear that false allegations such as these are part of a concerted campaign of political sabotage to topple a democratically elected Prime Minister."

He accused former Prime Minister Mahathir Mohamed of "working hand in glove with foreign nationals, including the now discredited political attack blog Sarawak Report," to take him down.

According to Tom Wright and Bradley Hope, authors of "Billion Dollar Whale: The Man Who Fooled Wall Street, Hollywood, and the World" who reported on the case for the Wall Street Journal, by this time Justo was not the only leaker, as those within the Malaysian state began to fear Najib would shrug off the scandal.

"Members of the group shared further password-protected documents on their investigation with the Journal. The password for many of the files: 'SaveMalaysia'," they wrote.

Documents were also passed to Rewcastle-Brown, who kept the pressure up on Najib with a series of carefully sourced reports showing how he had allegedly benefited from the 1MDB cash.

"There were plenty of people within what Trump would call the 'deep state' who thoroughly disapproved of Najib," she said. "They could find information, which made its way to yours truly."

Malaysia has struggled for decades with corruption and entrenched privilege, but according to Rewcastle-Brown, it all "got out of control under Najib."

"It had been kind of contained under the strong rule of his predecessors," she said. "Najib had grown up with that corrupt mentality, that's what he was nurtured on, and didn't understand the need for limits."

It was this backlash from the traditional elite, along with a major push by anti-corruption activists and ordinary people who took to the ballot boxes in their droves, which would eventually bring down Najib.

Autocratic turn

In mid 2015, Attorney General Abdul Gani Patail informed police investigators had enough information to prepare a charge sheet against Najib.

Clearly, his attempts to contain the scandal were not working, and so Najib began to tighten his grip on Malaysian society. Abdul Gani was pushed out of his job for "health reasons" and replaced by a Najib ally who would later clear the Prime Minister of any wrongdoing. Senior police and government officials involved in the investigation or critical of Najib were also replaced.

After Rewcastle-Brown got hold of the charge sheet and published it, Malaysia issued an arrest warrant for the reporter for committing an act "detrimental to parliamentary democracy" and attempted to place her on the Interpol red list.

"They thought that when I came out with the story originally at the start of 2015 that they could contain it," she said. "They created me into this sort of monstrous machine of forged documents and all the rest."

While she was safe in the UK, journalists in Malaysia were more vulnerable. Edge publisher Ho Kay Tat had already been arrested on sedition charges, and now the authorities moved to suspend the newspaper's publication license altogether.

To clamp down on anti-government demonstrators, yellow clothing with the slogan "Bersih" -- the word meaning "clean" used as the name for the protests -- was banned.

While he might have been able to contain the anger on the streets, Najib had underestimated the frustrations bubbling up within the Malaysian state.

"At the Malaysian Anti-Corruption Commission, which had recommended the prime minister's arrest, there was simmering anger over the mothballing of their investigation," Wright and Hope wrote. "And so, a handful of investigators began to secretly feed information to the FBI."

In July 2016, the US Justice Department stunned Malaysia by filing suit to recover more than $1 billion in assets it said had been embezzled from 1MDB.

This was the "point of real no return (for Najib), although he probably didn't see it," Rewcastle-Brown said.

As prosecutors in the US chased assets and witnesses, 1MDB began to collapse under the weight of its massive borrowing. While Najib tried to win back favor following US President Donald Trump's election, meeting the American leader in Washington in late 2017, this did not stop the Justice Department's pursuit of him.

Najib, who had long courted Washington as a key ally, now turned to China. Chinese companies reportedly agreed to help bail out 1MDB, giving it a temporary reprieve, though some of the deals later fell through.

Election shock

Despite everything, despite the years of near constant negative headlines, lawsuits in multiple countries, and activists, journalists and whistleblowers screaming to the rafters about his alleged corruption, as Malaysia entered 2018, few counted Najib out.

Malaysia's opposition had never won an election. Its most dynamic politician, Anwar Ibrahim, was in jail on charges of sodomy, and while the various parties had formed a coalition led by former prime minister Mahathir Mohamed, he was 92, and with a dubious history of his own.

Beyond this, the Malaysian electoral map was heavily skewed in Najib's favor, with some estimates saying his Barisan Nasional coalition could win a majority in parliament with less than 20% of the popular vote.

The government put its thumb on the scale further with a new law claiming to crack down on "fake news" which critics said was a thinly masked attempt to criminalize criticism of Najib. Weeks before the poll, Mahathir's party was dissolved for allegedly missing paperwork and he faced charges under the new "fake news" law.

For Rewcastle-Brown and other critics, it was clear that a Najib win would result in a strong tilt towards autocracy and greater corruption.

"Malaysia was on the brink of utter catastrophe," she said. "He was running the economy into the ground and China's hands, turning the place into a dictatorship. If he'd won that election it would have been the validation he was looking for."

But while "no one thought that this powerful grip he had on the country could be relinquished (this) was the only chance Malaysians had."

"People would all say 'oh that's impossible,'" Rewcastle-Brown said. "What won it was that (despite this) they all went, they owed it to themselves and country to go to the ballot boxes."

Over 76% of the 14.3 million eligible voters in the country turned out. They returned a Parliament of the sort never seen in Malaysia, with Mahathir's opposition coalition taking 121 of 222 seats, leaving Najib's Barisan Nasional just 79.

"We did not anticipate that the wave of change was such a phenomenal and so convincing. That (Najib) had to acknowledge it and quit," Anwar told CNN months after the election.

Downfall

Within days of the stunning election loss, Najib and his wife had been barred from leaving the country. Police soon raided their properties and seized millions of dollars in luxury goods allegedly linked to the 1MDB funds.

In July 2018, three years after the first stories had begun emerging about 1MBD, Najib was charged with four counts of corruption. The charge sheet would later expand to cover dozens of other alleged crimes. His wife, Rosmah Mansour, whose profligate and public spending with funds allegedly embezzled from 1MDB had helped fuel public outrage, was arrested months later.

Finally, this week, after years of allegations and scandal, and numerous attempts to extricate himself and shut it down, Najib must face his accusers, in what some Malaysians hope could be a transformative moment for the country, when it finally sheds its old reputation and transforms into an open democracy governed by the rule of law.

Its new rulers at least are clear this transformation will not stop with Najib.

"I think the key people who are responsible must be held accountable," Anwar said. "You must either accept this new regime of transparency and good governance, or you get out."