A Mexican federal court has dismissed charges against Elba Esther Gordillo, a former leader of the country's most powerful teachers union.

Ms Gordillo led one of Latin America's largest unions and spent almost five years in prison awaiting trial.

Last year she was transferred from jail and placed under house arrest.

She was accused of embezzling union funds and arrested the day after a major education reform that she opposed was signed into law.

She always denied the charges and described herself as a political prisoner.

Ms Gordillo ran the 1.5 million member Mexican teachers' union (SNTE) and was arrested on suspicion of embezzling $200m.

She reportedly spent millions on plastic surgery, property and a private plane.

The reforms she opposed were designed to change a union-dominated system in which teaching positions could be sold or inherited.

In a letter read by her lawyer, Ms Gordillo said of her discharge: "I need time to privately assimilate the emotions that stem from such an important personal issue."

It was not clear if the government will appeal the federal court's decision to throw out the charges.

The attorney general's office says that while it "respects the decision.. it does not agree with it."

Mexico's new left-wing president, Andres Manuel Lopez Obrador, will take office in December.