(CNN) -- A political crisis in Honduras escalated Thursday as a defiant President Jose Manuel Zelaya Rosales, followed by hundreds of supporters, led a loud but peaceful protest to a military base in order to personally take possession of thousands of ballots to be used in a contested referendum Sunday.

President Manuel Zelaya Rosales, middle, reviews troops with Gen. Romeo Vasquez Velasquez, right, in 2008.

Zelaya, a leftist elected in 2005, suddenly found himself pitted against the other branches of government and military leaders over the issue of the referendum.

The referendum at the center of the storm asks voters to place a measure on November's ballot that would allow the formation of a constitutional assembly that could modify the nation's charter to allow the president to run for another term.

Zelaya, whose four-year term ends in January 2010, cannot run for re-election.

The Hondurans Supreme Court had ruled the referendum illegal, and Congress and the top military brass agreed, but Zelaya remained steadfast.

"Sunday's referendum will not be stopped," Zelaya said at the entrance of the military base where boxes of ballots were removed from storage and put into trucks to be taken to the presidential palace. Moving the ballots prevented them from being voided or destroyed to comply with the court's ruling of the illegality of the vote.

Zelaya and his supporters braved an overcast and rainy day and sang the national anthem as the cardboard boxes filled with ballots were moved out of storage.

"We have the right to vote and the right to organize," Zelaya said. "The military should rectify their position in favor of the people and ignore the extortion of the elite."

The protest was the latest in a day of developments that have created a political crisis in a country where some 70 percent of the population lives in poverty.

Earlier Thursday, the Supreme Court ordered that the military's top commander be returned to his job immediately, a little more than 12 hours after Zelaya fired the general for saying the armed forces would not support the referendum.

Gen. Romeo Vasquez Velasquez had said the military was caught in a difficult position because the Supreme Court had ruled earlier that the referendum is illegal, but Zelaya was going ahead with the vote and instructed the armed forces to provide security.

The heads of the army, navy and air force had resigned to show their support for Vasquez.

Zelaya referred to the court as the "Supreme Court of Injustice" after their ruling.

The court ruled 5-0 that Zelaya violated the general's constitutional rights by firing him without cause, said magistrate Rosalina Cruz.

Also on Thursday, the National Congress convened an emergency session at which many members lauded Vasquez and the military, calling them "heroes."

The general's firing was arbitrary, many members said.

The president of the Congress, Roberto Micheletti, said the assembly unconditionally supports the armed forces for respecting the constitution, news reports said.

In another blow for Zelaya, the Supreme Electoral Tribunal said Thursday the referendum is illegal.

The military chief had said after he was fired that he respected the president's decision to dismiss him but could not violate a Supreme Court order last week that prohibited the military from supporting the referendum.

"We are soldiers and we have to comply with our responsibilities," Vasquez said early Thursday.

"We are not afraid of any judge," he said. "We are only afraid of the judge of history."

Zelaya said he would ask the Organization of American States to investigate the "crisis," which he said was being perpetrated by people who want to hurt democracy in Honduras.

Congress passed a law Tuesday night that would prohibit a referendum 180 days before or after the planned November general election. Under that law, Sunday's referendum could not be held.

Politicians huddled Thursday as tension gripped the nation. Rumors of a coup had been circulating for days, heightened Wednesday when the armed forces were placed on high alert and held training exercises to prepare for civil disturbances and urban warfare, news reports said.

There were no signs of any military intervention Thursday, though.

David Matamoros, a member of the nation's Supreme Electoral Tribunal, said on CNN affiliate Televicentro that the election panel supports the military's action.

The military ruled Honduras for 25 years, until a democratically elected civilian government came to power in 1982.

Zelaya narrowly won the presidency on November 27, 2005, garnering 49.8 percent of the vote to 46.1 percent for Porfirio "Pepe" Lobo.

All About Honduras • Central America