Venezuela's Supreme Court has declared unconstitutional legislation passed by the opposition-controlled congress to free dozens of jailed politicians who are foes of President Nicolas Maduro's socialist government.

The decision Monday by the government-stacked high court had been expected after Maduro criticized the law as an attempt to destabilize his rule and pardon activists he blames for deadly unrest in 2014.

Among those who would have been freed by the amnesty law is Leopoldo Lopez, who led the 2014 anti-government protests. He is serving a nearly 14-year sentence for allegedly provoking violence during those protests.

The opposition had promised to free jailed activists after its stunning electoral victory in December's congressional elections. Several foreign governments have expressed support.