Nicaragua's Supreme Court has thrown out the current leader of the main opposition party and reinstated a former leader who had sued for control of the Independent Liberal Party.

Current leader Eduardo Montealegre has been building a coalition to compete against President Daniel Ortega, who is running for his third consecutive term. But the court ruled that former party vice president Pedro Reyes Vallejos is the legal representative of the party, based on a suit Reyes Vallejos filed about five years ago.

The ruling invalidates the nominations of the Independent Liberal Party's candidates for the Nov. 6 elections.

Montealegre said Thursday that "this is a coup against the opposition because Ortega is afraid of us."

Ortega has been criticized for stacking the judiciary with his supporters.