CARACAS (Reuters) - Venezuela on Monday freed opposition lawmaker Gilber Caro, who was detained in April in what allies said was a violation of his parliamentary immunity, the opposition-controlled National Assembly said on Twitter.

FILE PHOTO: Venezuelan opposition lawmaker Gilber Caro speaks during an interview with Reuters in Caracas, Venezuela June 12, 2018 in this still image taken from a video. REUTERS TV/ via REUTERS

The move by President Nicolas Maduro’s government, which faces a challenge to its legitimacy from National Assembly leader Juan Guaido, comes days before a visit by Michelle Bachelet, the United Nations high commissioner for human rights, to meet victims of rights abuses and speak with both leaders.

“The parliamentarian Gilber Caro should never have been jailed,” the National Assembly said. “Today he comes out from behind bars, but just like all Venezuelans, he still is not free.”

In January, Guaido invoked the constitution to assume an interim presidency, calling Maduro a dictator and saying his 2018 re-election was illegitimate. He has been recognized as Venezuela’s rightful leader by dozens of countries, including the United States and most South American neighbors.

Maduro calls Guaido a U.S.-backed puppet seeking to oust him in a coup. He retains control of state functions and Venezuela’s armed forces.

The U.N. last month criticized the Maduro government’s handling of Caro’s arrest, saying its failure to confirm his fate and whereabouts constituted an “enforced disappearance” under international law.

Caro, who had previously spent 18 months in jail on treason and weapons charges between 2017 and 2018, was freed from the Sebin intelligence agency’s Caracas headquarters, known as the Helicoide, attorney and former lawmaker Pedro Diaz-Blum told Reuters.

Diaz-Blum is a member of the Boston Group, a network of U.S. and Venezuelan legislators that has served as an intermediary between the government and the opposition for more than a decade. The group on Monday posted a brief video on Twitter of Caro greeting some of its members in an office.

Rights group Penal Forum said Melvin Farias and Junior Rojas, two men it called political prisoners and said had been jailed for more than a year, had also been freed.

Several politicians close to Guaido who have been arrested in recent weeks remain behind bars, including his chief of staff Roberto Marrero and National Assembly Vice President Edgar Zambrano.