Johannesburg (CNN) -- South Africa's National Assembly passed legislation Tuesday that critics say is a threat to journalistic freedom and anti-corruption efforts.
Members of parliament passed the Protection of State Information bill by a vote of 229-107, with two abstentions. The bill now moves to the National Council of Provinces for approval, and many groups are already preparing to challenge its constitutionality in the country's courts.
Protesters dressed in black gathered in several cities ahead of the vote, while newspaper headlines screamed "Black day for press freedom" and the media declared the day "Black Tuesday" -- a reference to what was known as "Black Wednesday" in 1977, when the country's apartheid government banned two newspapers and several anti-apartheid groups.
The law makes obtaining, leaking or communicating classified state information punishable by a prison sentence of up to 25 years. It also allows all federal and local officials to classify any document as secret. Without a public interest defense clause in the legislation, some worry it will criminalize investigative journalism.
"In its current form, the bill represents an attack on the principles of open democracy that are deeply embedded in our Constitution and our national life," an editorial in The Star newspaper reads.
In a statement after the vote, ANC spokesman Keith Khoza said the bill has "nothing to do with the muzzling of the media and the right to free expression."
"There has been strong opposition (to the measure) as it does not contain a public interest clause, but if it had been included, it would have nullified the whole act," Khoza said. "If people want access to information legitimately then they can access it through the Access of Information Act."
That act, Khoza said, is not nullified by the state secrets bill.
"If one can demonstrate it is in the public interest and that it will not affect of the function of the state then that information can be accessed," he explained.
"This bill is important to the country. It provides for the classification of confidential information by the security arm of the state. We believe that any country reserves the right to keep state information classified and peoples' information classified, especially information regarded as confidential," Khoza said.
Nobel laureates Desmond Tutu and Nadine Gordimer are among the bill's most prominent critics. Gordimer, an anti-apartheid activist and personal friend of former President Nelson Mandela, has accused the ruling African National Congress (ANC) of taking South Africa beyond apartheid.
"People have fought and died to gain the opportunity for a better life, which is ruined and dirtied by corruption," she said.
Amnesty International, in a statement before the measure passed the National Assembly, said it would consider journalists and whistleblowers arrested under the law as "prisoners of conscience."
"This fatally flawed bill, which is totally at odds with the South African constitution, takes us right back to the apartheid-era restrictions on free speech," said Noel Kututwa, Amnesty International's deputy director for Africa, in a statement Monday.
Speaking to CNN days ahead of the vote, former finance minister and current National Planning Minister Trevor Manuel defended the law.
"There isn't a single country in the world that runs its business without secrets. I can't understand why there is an expectation in the minds of some people in the media for South Africa to behave like silly clowns. We have the responsibility to govern this country and don't ask us to give up that responsibility," he said.
Critics say there's a good deal of corruption in South Africa. Recently two ministers were fired and the country's police chief was suspended, accused of misappropriating millions of dollars. Their actions were exposed by the media.
"A public interest clause is crucial in ensuring that the bill does not become an instrument to suppress information that may reveal wrongdoing," the Star Newspaper's editorial said.
And in what has been called a preview of what's to come under the law, presidential spokesman Mac Maharaj has pressed charges against two investigative journalists working for the weekly paper the Mail & Guardian. The newspaper claims to have uncovered evidence that Maharaj illegally benefited from the country's multi-billion dollar arms procurement contract, but says it couldn't publish that information after Maharaj threatened legal action against the paper for allegedly obtaining the information illegally. The Mail & Guardian printed the story with a "censored" banner across the front page and blackened out details it says are proof of wrong-doing.
In 2009, the ANC disbanded an elite investigative unit that probed various politicians for corruption, including President Jacob Zuma. While Zuma's case was dropped, the country's former police chief, Jackie Selebi, was sentenced to 15 years in prison for corruption. He is appealing his sentence.