By Adam Mynott
BBC News, Nairobi
Kenyan President Mwai Kibaki has refused to sign into law a bill which has been condemned as a crude attempt to muzzle the media.
Journalists say anonymous sources have helped expose major scandals
Mr Kibaki said the bill posed a threat to Kenya's recent democratic gains, and it would be sent back to parliament.
The bill would have allowed courts to force reporters to reveal sources.
Hundreds of Kenyan journalists rallied outside the Kenyan parliament last week with their mouths symbolically clamped shut with sticky tape.
In a statement, President Kibaki described the bill "as a threat to the democratic gains that Kenya has made in the recent past".
Mr Kibaki has described the bill as a "threat" to democracy
There were a number of controversial provisions in the bill, but the one that attracted the fury of Kenyan journalists was a clause allowing courts to force them to reveal their sources.
Kenya has a robust media.
It has used anonymous sources to expose a number of cases of corruption at the heart of the government, which have cost the taxpayer millions of dollars.
The bill will now be returned to parliament.