South African MPs have approved a controversial Protection of State Information Bill despite widespread criticism, prompting protesters to call the day "Black Tuesday", the darkest day for South African democracy since the end of apartheid in 1994.

The National Assembly voted in the Protection of Information Bill on Tuesday, with 229 votes in favour of the bill, two abstentions and 107 votes against it.

All the opposition parties present in the house voted against the bill and hundreds of protesters dressed in black to show their opposition to the measure outside of Parliament and in various cities across the country.

Editors who attended the parliamentary session staged a walkout after the measure passed.

The bill still has to be passed by the upper house and signed by the president before it becomes law.

Officially, the bill is aimed at creating "a coherent approach to protection of state information and the classification and declassification of state information and will create a legislative framework for the state to respond to espionage and other associated hostile activities".

Protesters have warned that, if signed into a law, the measure would give the state the power to classify documents as secret in the "national interest".

Many fear that such documents could include reports about government corruption and human rights abuses.

Provisions included in the bill stipulate that anyone caught distributing classified documents could be punished with a three- to five-year term, while people found guilty of the unlawful delivery and distribution of "top secret" material can be punished by 15 to 25 years in jail.

The move has been widely criticised by the opposition, media, civil society and rights groups, including the South Africa Human Rights Commission, which said it could impact negatively on basic human rights.

Nobel Peace laureate Archbishop Desmond Tutu called it "insulting" and said it could be used to outlaw "whistle-blowing and investigative journalism".

The main opposition Democratic Alliance warned that it would petition the Constitutional Court to have the bill declared unconstitutional if President Jacob Zuma signed it in its current form. The court would require 136 MPs to sign the petition before it can hear the case.

The National Press Club, backed by the Right2Know campaign group, had called on protesters to wear black clothing or a black ribbon or armband on the day the vote was scheduled to be held. The name Black Tuesday was chosen in reference to 19 Oct, 1977, known as Black Wednesday, where the apartheid government banned several well-known South African papers and 19 black consciousness organisations as well as individuals, following the death in police detention of the prominent activist and writer Steve Biko.

All the major newspapers have published editorials condemning the proposed measure, including the Sunday Times, which said in its 20 Nov editorial: "The South African public will be deprived of the vital oxygen of free information."

In contrast, the ruling African National Congress (ANC) insists the law will safeguard state secrets and national security.

"You cannot compare the situation that existed under the draconian and inhumane apartheid [regime] with legislation proposed by a democratic parliament elected by a majority of the people of South Africa," said chief whip Mathole Motshega.

The ANC has dominated party politics for 17 years and, since the end of the apartheid regime, the media has enjoy relatively greater freedom compared to some other African countries.

Following a series of financial and corruption scandals, however, many now fear the ANC could try to make it more difficult for the press to criticise and denounce the government.