During the three and a half years that she was held in prison or under house arrest, Judge Lourdes Afiuni became a symbol of political persecution for many in Venezuela under President Hugo Chávez. On Friday, a court in Caracas, acting at the government’s request, ordered Ms. Afiuni to be set free in the latest sign of a shifting political landscape in post-Chávez Venezuela.

Ms. Afiuni was jailed in December 2009 after issuing a court ruling that infuriated Mr. Chávez, who went on television and demanded that she be sentenced to 30 years in prison. For years Mr. Chávez ignored international appeals for her release, including from the American leftist intellectual Noam Chomsky.

Mr. Chávez, a charismatic socialist, died in March, leaving a bitterly divided country.

His handpicked successor, Nicolás Maduro, was elected by a slim margin in April and since then has confronted political turmoil and serious economic difficulties that have tested his nascent leadership skills. As Mr. Maduro lurches from one crisis to the next, the quality he seems to have honed most is delivering mixed messages at top volume.

He branded President Obama “the big boss of the devils” and then sent his foreign minister to shake hands with Secretary of State John Kerry and call for warmer relations.