The flow of traffic around the square -- the focal point of the 2011 revolution that ousted former President Mubarak 16 months ago -- was disrupted as the number of protesters increased, officials said.
Other crowds gathered outside the Supreme Constitutional Court in the Cairo suburb of Maadi chanting, "Down with military rule."
"Egypt just witnessed the smoothest military coup," Hossam Bahgat, director of the Egyptian Initiative for Personal Rights, wrote in a Twitter post. "We'd be outraged if we weren't so exhausted."
The court -- 18 judges appointed mostly during the Mubarak regime -- said the law governing Egypt's complex parliamentary elections, held from Nov. 28, 2011, to Jan. 11, 2012, contained illegal provisions as well as legal provisions that were not followed.
For instance, individual candidates were meant to be "independents," but political party members were later allowed to run, giving the powerful Muslim Brotherhood's Freedom and Justice Party an unfair advantage, the court ruled.
The ruling, which cannot be appealed, means the first freely elected Parliament in decades must immediately be dissolved and the whole parliamentary vote must be redone, said court Chairman Farouk Sultan, appointed by Mubarak in 2009.
With both houses of the Islamist-led Parliament dissolved, the ruling military's top generals have taken over legislative powers, authorities said.
The generals, a day ahead of the ruling, reimposed martial law Wednesday, giving military police and intelligence services the right to arrest and detain civilians.
Security forces lost that power last month with the lifting of Egypt's much-criticized decades-old state of emergency.
The court also ruled the military's favored candidate, Ahmed Shafiq, a former Egyptian Air Force senior commander, had a right to run in this weekend's presidential runoff vote.
The ruling overturned a law Parliament had passed banning Shafiq, as a holdout representing the overthrown regime, from running.
Shafiq -- who said he considered Mubarak a "role model" -- told hundreds of cheering supporters at a campaign rally the court's twin rulings were "historic."
"We will never again humiliate the judiciary," he said.
Shafiq was Egypt's prime minister from Jan. 31, 2011, to March 3, 2011, resigning a day after a contentious talk show confrontation in which a prominent Egyptian novelist accused him of being a Mubarak regime holdover.
Mubarak was ousted as Egypt's president Feb. 11, 2011, after 18 days of massive demonstrations.
The 70-year-old candidate was to face Muslim Brotherhood candidate Mohamed Morsi, 60, in a presidential runoff election this weekend, but activists and others called for an election boycott, and the military -- which holds executive authority until a president is elected -- can decide to hold the elections on a different date.
The Freedom and Justice Party said it was considering withdrawing Morsi from the runoff to invalidate its legitimacy, The New York Times reported.
Morsi, however, said he respected the court rulings "in that I respect the institutions of the state and the principle of separation of powers."
In Washington, U.S. Secretary of State Hillary Clinton said, "There can be no going back on the democratic transition called for by the Egyptian people."
"In keeping with the commitments that the Supreme Council of the Armed Forces made to the Egyptian people, we expect to see a full transfer of power to a democratically elected government," she said.
The military generals had promised to hand over power to the democratically elected government this month after the election.
Celebrity Families of 2014 [PHOTOS]