“Jair Bolsonaro being president was a ridiculous proposition two years ago,” wrote Igor Gielow in Brazil’s Folha de Sao Paulo on Sunday about the president-elect.

In many ways, Bolsonaro – a former military captain advocating smaller government, harder crackdowns on state corruption, and expanding gun rights and religious freedoms – had essentially won the election almost precisely two years ago, when nearly four million Brazilians took the streets of major cities nationwide demanding impeachment for socialist President Dilma Rousseff.

The 2018 presidential campaign was always his to lose, as the only viable conservative candidate with no known corruption history, and he did almost lose it. Bolsonaro prior to mid-2018 was quick to defend military dictators, lob childish insults against political rivals, and lament Brazil’s sexually liberal culture in a country whose citizens just wanted to know what happened to their money under the socialists’ watch.

Yet this year, the candidate stopped letting the left, and the mainstream media, distract him out of talking about the disaster that was 13 years of Workers’ Party (PT) rule. Bolsonaro honed his message around corruption in the home of arguably the largest multinational corruption scheme in modern history. He turned to Venezuela, warning that “when Venezuelans took to the streets [against socialism], it was already too late.” Most importantly, he learned when to keep out of the spotlight and let the Workers’ Party (PT) and the radical left disgust the Brazilian people without interruption.

Bolsonaro handily won Sunday’s election with 55 percent of the vote over the PT’s Fernando Haddad, who proved a weak replacement for the party’s first choice, Luiz Inácio Lula da Silva. Lula is currently serving a 12-year prison sentence for taking over $1 million in bribes while president (2003-2011) and buying a luxury beachfront property. He was sentenced on final appeal in January, rendering his candidacy illegal, but refused to step aside until September, leaving Haddad less than a month to campaign before the first round of voting in early October.

Lula was once the heavy favorite to win in 2018, then he got arrested, the highest-ranking official caught in a web of corruption known as “Operation Car Wash.” Under Lula – and his minister of energy, Dilma Rousseff – the state-run oil corporation Petrobras came to an agreement with private contractors like Odebrecht in which they would allow the contractors to overcharge on infrastructure projects in exchange for bribes. The government would pay the firms more taxpayers’ dollars than the job required, and the firms would kick the excess funds back to the politicians to secure future contracts.

“Operation Car Wash” was the largest, but not sole, PT corruption scheme. There’s the “Olympic corruption” prosecutors unveiled surrounding the 2016 Rio de Janeiro Summer Olympics, secured under Lula. Similar to the Petrobras scheme, Attorney General Rodrigo Janot alleged a year ago that the PT leadership “built an organized crime operation using their roles in the government to secure kickbacks and bribes for themselves and their cronies.”

The investigation into the 2014 FIFA World Cup, another Lula achievement, is in a less advanced stage currently, but prosecutors opened a case investigating corruption therein in February, after Brazil spent over $6 billion on the event.

Brazil spent $13 billion on the Summer Olympics. The event was estimated to cost $4.6 billion.

In Brazil, police stations have to ask locals for toilet paper donations because the government will not pay for officers to buy more for their bathrooms. Police seem equipped with enough tear gas to attack the teachers, who have repeatedly protested for nearly a decade against meager salaries and pensions, but not equipped with enough gear to prevent prison riots where rival gangs grill each other in makeshift “barbecues.”

The PT responded to all criticism against it with arrogance. Upon being arrested, convicted, convicted again, and convicted a third time, Lula insisted that only “death” could keep him from politics. On the ballot, “only Jesus Christ can beat me in Brazil,” he insisted.

Rousseff, removed from office two years ago but still trying (unsuccessfully) to enter the Brazilian Senate, declared war on Netflix. The entertainment company produced and published a series called The Mechanism, a fictionalized drama explaining how Operation Car Wash works from the perspective of a low-level police team in Curitiba, where the scheme was first revealed, demonized by the federal government for pursuing the case.

“Netflix can’t run political campaigns,” an infuriated Rousseff, depicted unflatteringly in the series, said in March. “Netflix doesn’t know where it has stuck its nose.”

The campaign was always Jair Bolsonaro’s to lose. And he almost lost it.

The Bolsonaro of 2017 is a distant memory to many, when he was still answering questions about favorable comments regarding Chilean dictator Augusto Pinochet and making jokes like “I don’t understand anything about economics.” He appeared more concerned with “gender ideology” than fighting corruption or shutting down violent drug traffickers. He tried to compare himself to U.S. President Donald Trump by saying, “Trump faced the same attacks I am facing—that he was a homophobe, a fascist, a racist, a Nazi.”

It did not matter if Bolsonaro was right; he was still providing soundbites with the word “Nazi” in them to a media establishment desperate to destroy him.

Bolsonaro’s message began to change following the final conviction of Lula. He made Lula the voice of the PT to drown out Haddad, urging Brazilians in the final days of the campaign to not let the country be run “like a criminal gang, out of prison.” As Bolsonaro turned attention towards the PT and the left generally, socialists grew increasingly unhinged and unpalatable to the average Brazilian.

The more popular Bolsonaro appeared in the polls, the louder and angrier the left became, culminating in the September 6 assassination attempt he suffered. A man later identified as a longtime socialist ran up to Bolsonaro during a campaign rally and stabbed him in the abdomen, severely damaging his digestive system. The man said he was “ordered by God” to kill him before he became president.

“Bolsonaro’s rhetoric invariably uses violent metaphors,” Gielow, the shocked columnist mentioned above, wrote following the assassination attempt. “Could this generate a reflection, a rejection of the defense of those extremes associated with the formation of Bolsonaro’s candidacy?”

Brazilians didn’t buy it. Nor did they buy it when Folha published a diplomatic cable it claimed confirmed that Bolsonaro had threatened to kill his ex-wife while Bolsonaro was still recovering from the stabbing.

They didn’t buy it when the left opened October with a series of radical leftist protests labeled “Ele Nao,” or “Not Him,” popped up nationwide the weekend before the first round of voting. Even larger rallies, this time in Bolsonaro’s favor, occurred the next day.

The candidate then gained support among women following these two events targeting female voters.

During the final stretches of the campaign, Bolsonaro opted against directly addressing the attacks against him like he did in the past, with attempts to outdo the outrage already existing against him. Instead, he returned time and time again to the crimes of the Workers’ Party, the devastation that socialism necessarily creates, and his campaign motto: “Brazil above everyone, God above everything.”

Brazilians have much work ahead of them; electing someone on a conservative platform does not guarantee that the candidate will deliver. Bolsonaro may be beloved, but he is still a politician, one susceptible to as much lobbying and corruption as anybody else. A return to prior form – losing focus on key issues, being belligerent for the headlines – will ensure Bolsonaro won’t be president for long. Voters have a responsibility now to ensure that Bolsonaro’s political fate depends on him keeping his promises.

Follow Frances Martel on Facebook and Twitter.