Judge Miguel Angel Luna said he was sitting in his courtroom on Feb. 28 when prosecutors brought in two beer-truck drivers, who had been parked near an anti-government demonstration, and demanded that they be jailed.

But there were no charges against them, Luna recalled. So he set the two men free. Three days later he was fired by the president of the Supreme Court without explanation.

"The regime of President Hugo Chavez has turned our democracy into an autocracy," said Luna, 58, who has returned to his private law practice and believes that his only offense was to defy the political wishes of the president and his supporters. "Judicial autonomy has been lost, and that is the foundation of democracy."

Luna's case illustrates how politics has eroded the judicial system, threatening the rule of law in one of the world's most important oil-producing nations. The loss of judicial autonomy could affect an Aug. 15 national referendum on whether to recall Chavez, according to political and legal analysts in Venezuela and a report released last week by the New York-based organization Human Rights Watch.

The Chavez government presides over a judicial system where most judges can be fired at will. The National Assembly has also just passed a law that will allow Chavez and his allies to pack the supreme court with sympathetic justices who could end up deciding any challenges to the recall election, analysts said.

The government argues that it is cleaning up a corrupt and inefficient judiciary it inherited when Chavez was elected in 1998, and trying to rein in the anti-Chavez groups who backed a coup in April 2002 and a strike at the national oil company last year that cost the country billions of dollars. The justice system in Venezuela has historically been corrupt and Chavez fired hundreds of judges immediately after his election, a purge that was widely seen as necessary.

But critics said Chavez, a former paratrooper who led a failed coup in 1992, had gone beyond the changes needed to reform the judiciary. They said he was trying to silence dissent and create an authoritarian government in the style of Fidel Castro's Cuba.

"This is a political assault on the judicial system," said Pedro Nikken, a constitutional lawyer in Caracas. "It's making the judiciary a branch of the executive. They are going to use this to attack the dissidents and guarantee the impunity of any abuses of human rights or acts of corruption by the government."

In its report, Human Rights Watch said the "most brazen" challenge to the rule of law in Venezuela was a new statute pushed through the National Assembly by Chavez allies last month that expands the Supreme Court from 20 to 32 justices and allowed the Chavez-dominated assembly to fire and hire justices with a simple majority vote. Previously, firing a justice required a two-thirds majority.

The report said the new law amounted to a "political takeover" of the court. It said the law would allow Chavez and his allies to "pack and purge the country's highest court," which is currently split 10 to 10 between judges seen as loyal to Chavez and those viewed as his opponents. The report called on the Organization of American States to investigate.

"We are not talking about what could happen, we are talking about what is already happening," Jose Miguel Vivanco, head of the group's Americas division, said at a news conference. He noted that on Wednesday pro-Chavez legislators voted to fire one Supreme Court justice and to begin proceedings to suspend two more. All three were widely seen as opponents of Chavez and had ruled against his wishes in recent high-profile cases.

Only 20 percent of Venezuela's 1,732 judges have tenure and job security; the rest are either provisional or temporary judges who can be fired at will by the Supreme Court's six-member administrative council, the report noted.

The Chavez government responded to the report with ferocious rhetoric.

The National Assembly's leadership said it would consider declaring Vivanco a "persona non grata" in Venezuela. Vivanco said he was detained briefly by federal political police at the Caracas airport as he left the country Saturday morning, which he described as an act of harassment and intimidation. Assembly President Francisco Ameliach Orta, quoted in local media, said the report reflected "total and absolute ignorance" and accused Human Rights Watch of "open and unpardonable meddling in the internal affairs of our country." He said the Supreme Court overhaul was passed by the National Assembly and represented the will of the majority of the Venezuelan people.

Tarek William Saab, a key Chavez ally in the Assembly and head of the Foreign Relations Commission, said in an interview that critics failed to give the government credit for its efforts to "create an autonomous and independent judicial branch" and put an end to the "enormous impunity" that existed before Chavez took office.

Saab said it was wrong to say that Chavez controlled the judiciary. If he did, Saab said, the leaders of the 2002 coup against Chavez and those who led the oil company strike would be in jail. "They have not been put in jail because of the lack of ethics on the part of judges linked to the opposition," Saab said.

Still some analysts, including Alberto Arteaga Sanchez, a noted criminal attorney in Caracas, said Chavez and his allies were "using criminal law against their political adversaries."

One of Arteaga's clients is an army general who was involved in the 2002 coup against Chavez. Arteaga said the Chavez government had proposed an overhaul of Venezuela's criminal code that called for up to six years in jail for "publicly or privately instigating disobedience of the laws or hatred among citizens." Arteaga said even a private discussion among friends could result in prison time.

The reform calls for up to five years in jail for "causing panic" by disseminating "false information," even by e-mail. And it would jail anyone who "simply intimidates" or "pressures" public servants. Arteaga and Nikken said that would include the habit of harassing public officials by "casseroling" them: annoying them by banging a spoon loudly against a pot.

"This government is starting to show signs, like we saw in Cuba, of criminalizing political dissidence," said Nikken, noting that last year the Cuban government sentenced 75 non-violent dissidents, including journalists and librarians, to long prison terms.

Potential political influence in the judicial system is especially critical now because of the recall referendum scheduled for Aug. 15. After years of trying to oust Chavez, first by coup and then through the oil strike, his opponents finally managed to gather enough signatures on petitions to force the recall vote.

Noting that Venezuela is deeply and passionately divided between those who support and those who oppose Chavez, Vivanco predicted that the referendum could be so close that it may ultimately be decided by the country's high court, just as the U.S. presidential election in 2000 was by the Supreme Court. Vivanco said it was critical that the court not be stacked with justices acting solely for political reasons.

Luna, the fired judge, filed a written appeal and was reinstated on April 15. But three weeks later he presided over a procedural hearing involving the case of another Chavez opponent. Following standard practice, Luna granted the man's request to allow two new attorneys to represent him. A week later, he was again fired.

Luna said he was one of nine children of a small-town merchant and the only person in his family to graduate from college. He said he worked as a lawyer for almost 25 years before becoming a judge four years ago. He said he had never been an opponent of Chavez. A soft-spoken man with gray hair and glasses, Luna said he was sad that his career on the bench had ended because of "pure revenge."

"We are waiting for the recall election to change our direction," he said, "to take us toward a horizon of peace and democracy in Venezuela."

President Hugo Chavez, in a televised address on June 3, told the nation -- and supporters outside the Presidential palace seen on a video screen -- that he would agree to a recall referendum following a recount of petition signatures.