A Mexican court has let two leaders of a radical teachers' union leave prison on a form of bail following weeks of protests by supporters over their arrests and recent education reforms that include mandatory teacher evaluations.

Attorney General Arely Gomez says the court did not absolve the men but rather freed them while legal proceedings continue. She denied on Friday that their release was politically motivated.

Prosecutors arrested the two leaders in June and accused them of setting up an illegal financial network to fund protests and line their own pockets.

The union effectively controlled the payroll of teachers in Oaxaca state.

Union officials allegedly demanded a 3.5 percent cut of unionized teachers' purchases at local businesses and took that out of members' paychecks.