Campaigners have long accused Aaron Ringera of not doing enough
Kenyan MPs have thrown out a proposal by the president to reappoint a much-criticised anti-corruption chief.
President Mwai Kibaki had intended to give retired judge Aaron Ringera a second five-year-term as head of the Kenyan Anti-Corruption Commission.
However, MPs said the proposal was illegal as they had not approved it.
The BBC's Wairimu Gitahi in Nairobi says Mr Ringera has come under fire from Kenyans for not doing enough to tackle corruption.
Donors also accuse the president of failing to keep his promises to tackle the rampant corruption in Kenya.
Since he took office in 2002, no senior officials have been convicted.
Our correspondent says after a heated, late-night debate the parliamentarians decided the president had acted unlawfully.
According to the law, an advisory board of the KACC is supposed to suggest who is to head the commission and also nominate two deputies.
The names are then sent to parliament for approval, which then hands it on for the president's approval.
When Mr Kibaki reappointed Mr Ringera of his own accord earlier this month, it immediately sparked protests from some politicians and anti-corruption campaigners.
The KACC head is Kenya's best paid civil servant, earning 2.5m shillings ($34,000; £21,000) a month - more than the president.
He has previously defended the lack of convictions by saying he does not have the powers to prosecute those accused of corruption.