Frida Ghitis, a former CNN producer and correspondent, is a world affairs columnist. She is a frequent opinion contributor to CNN and The Washington Post and a columnist for World Politics Review. The opinions expressed in this commentary are her own.

(CNN) Without a hint of irony, Venezuelan President Nicolas Maduro tweeted , "Let the world know. Millions of people are voting freely ... In Venezuela, it is the people who elect the president."

The world, of course, already knows, as do the Venezuelan people, that the country long ago ceased to be a democracy. Maduro, no matter what he claims happened in Sunday's election, is a dictator.

At a time when a global wave of authoritarianism is rising, a closer look at the Venezuelan tragedy reveals what was at the center of the power-grab: the dismantlement of the rule of law. It was this crucial tactic that turned one of Latin America's most enduring democracies into a basket case of social and economic collapse.

Maduro is one of the world's most incompetent presidents. He and his acolytes transformed a country of vast natural resources into one of spreading hunger, exploding murder rates and out-of-control inflation. How did they do it?

All populist autocrats try to foment divisions, find scapegoats and inflame their backers against their critics. But the path from populist autocracy to full-fledged dictatorship has one indispensable element: taking control of the judiciary and politicizing law enforcement. Once the executive controls the interpretation and enforcement of the law, it can do as it pleases.

Venezuela offers a case study in how by politicizing the law, the regime -- incompetent in every other respect -- managed to seize control of the country without the need to impose military rule.

It is no surprise that the World Justice Project ranks Venezuela dead last in its global Rule of Law Index.

Maduro and his mentor, the late President Hugo Chavez, had governed with the support of a legislature dominated by their party, the United Socialist Party of Venezuela (PSUV). After Chavez's death in 2013, the uncharismatic Maduro took power. Already-difficult conditions worsened and the legislative elections in December 2015 brought a surprise victory for the opposition.

With the opposition in control of the National Assembly, all pretense of democracy quickly unraveled. Almost immediately, in January 2016, the government declared a temporary state of emergency, handing the President the right to rule by decree on economic matters for 60 days.

The government had accidentally allowed the opposition to win the legislative election, but it had a firm grip on the courts. In subsequent months, the Supreme Court, completely dominated by the ruling party, reversed almost every law the opposition tried to enact.

The current chief justice is Maikel Moreno, a deeply controversial figure. Reuters looked into his background and found a 2006 intelligence report commissioned by Venezuela's Supreme Court, which includes his mugshot and criminal allegations, including homicide. But Reuters was not able to find documentation of a trial, sentencing or imprisonment for this accusation. Whatever the chief justice's history, the court has become an instrument of Maduro's political power.

Although the constitution guaranteed judicial independence, the Supreme Court, through its Judicial Commission, has the power to remove at will any of the "provisional" judges -- more than half of the judges in Venezuela. According to the International Commission of Jurists , "the separation of powers is non-existent," in Venezuela. The judiciary has become an instrument of the President and his party.

In keeping with that role, the court issued a stunning ruling the year after the opposition took control of the legislature. It removed the National Assembly's powers and took them for itself. The opposition called it a coup. The reaction was so violent that the court reversed course in a few days, but it was clear there was no way the regime was going to allow the democratically elected opposition to hold any of the levers of power.

A few weeks later, the court approved a plan by Maduro to hold elections for a new Constituent Assembly. Despite massive demonstrations in which scores of protesters were killed, the Assembly was elected, amid evidence of fraud

Once in place, it took over lawmaking duties, securing the third branch of government, with the regime in effect controlling the executive, legislative and judicial branches.

The attorney general at the time, Luisa Ortega, had been a loyal Chavista. But she criticized the regime's patently antidemocratic moves. The Constituent Assembly promptly fired her amid a campaign of character assassination. Fearing for her life, she made a dramatic escape by speedboat.

The Venezuelan government has not responded publicly to these claims. Ortega is speaking out across Latin America, describing corruption and human rights violations in a government where she worked for more than a decade. Ortega has become one of the regime's fiercest critics. She has accused the Maduro regime of crimes against humanity before the International Criminal Court in the Hague, claiming the authorities ordered arbitrary arrests, torture and killing of thousands of Venezuelans.The Venezuelan government has not responded publicly to these claims. Ortega is speaking out across Latin America, describing corruption and human rights violations in a government where she worked for more than a decade.

By the time Sunday's election took place, only the thinnest veneer of democracy remained in Venezuela. The courts allowed Maduro to ban from politics the most prominent opposition members. The opposition has struggled with how to respond, causing self-defeating divisions that infuriate the majority of Venezuelans who want Maduro out of power.

After nearly two decades under a government that constantly works to turn Venezuelans against each other, some in Venezuela accept Maduro's claim that their problems are the fault of the Americans or the opposition. But most people are fed up. Polls show Maduro's approval rating to be about 25%. But without democracy, the voice of the people does not decide who governs.

Follow CNN Opinion Join us on Twitter and Facebook

As the world tries to figure out how to help the Venezuelan people, one timely lesson from their tragedy is that protecting the rule of law, the independence of the judiciary, is a top priority in the defense against tyranny.