Friday's decision by the Constitutional Court may also hamper efforts to bring a case against Abu Bakar Bashir, the alleged spiritual leader of the Jemaah Islamiah, the group blamed for the Bali bombings, and draw international criticism.
The ruling does not annul the Bali verdicts, but dozens of people convicted for the 2002 Bali nightclub blasts that killed 202 people, mostly foreign tourists, were investigated and charged using the law. Three are on death row.
"The use of the law No. 16, 2003 contradicts the 1945 constitution," the head of the court, Jimly Asshiddiqie, said in his ruling. The nine judges on the panel ruled five to four against the law.
Jakarta has two anti-terror laws. Law No 15 is a broader piece of legislation while law No 16 enabled its application retroactively to the Bali case.
Indonesian law does not permit appeals against decisions by the constitutional court.
Indonesia enacted its first laws targeting terrorism days after the Bali bombings. A court official said Friday's decision did not affect the Bali verdicts.
Death sentences upheld
"This decision did not annul the verdict on Amrozi and others," justice assistant Muhammad Asrun told reporters, referring to the first Bali bomber to be convicted. Amrozi was sentenced to death.
Abd al-Gani Abd Allah, director-general of legislation at the justice ministry, said any new prosecutions for the Bali bombings could not be conducted under the anti-terror laws.
Amrozi was given the death
sentence for his role in Bali
"Those that have not been decided will use the criminal code," Abd Allah said. Bali bombers already convicted would need new evidence to have their cases reviewed, he added.
Wirawan Adnan, a lawyer for several Bali bombers, said he was considering appeals to the Supreme Court as a result of the ruling. "We will consider to appeal [sic] the Bali bombing convictions," he told reporters at the court. "We can call a retrial."
The ruling came just a day after President Megawati Sukarnoputri, locked in a tough election battle for a fresh term in office, praised the Bali prosecutors for their role in combating terror in Indonesia.
It is also a sensitive time as prosecutors prepare a case against cleric Bashir, in detention awaiting a decision by prosecutors on whether to bring formal charges.
"The decision will not affect any case which has already had a verdict on it," said Mahendradatta, one of Bashir's lawyers who also represented several Bali bombers.
"But for Bashir it is very different, because Bashir has not yet been tried."
Dr Hidayat Noor, the head of the Islamic Justice and Welfare party, said he believes Bashir will not benefit from the court's decision.
"The only beneficiaries are those activists who defend human rights and lawyers defending suspects accused of terrorism," he told Aljazeera.
Harkristuti Harkrisnowo, criminal law expert from University of Indonesia, said: "I think it would create an obstacle on the process for Bashir."