Kenya's President Uhuru Kenyatta has denounced the case against him at the International Criminal Court (ICC), which has now been dropped, calling it "obviously deficient" and a "travesty".
Mr Kenyatta said he felt "vindicated" that crimes against humanity charges had been withdrawn.
He had been indicted in connection with post-election ethnic violence in Kenya in 2007-08, in which 1,200 people died.
Prosecutors said the Kenyan government had impeded their investigation.
They accused it of refusing to hand over documentary evidence vital to the case and said potential witnesses had been threatened and intimidated.
Mr Kenyatta said he was "excited" and "relieved" that the case was over.
"My conscience is absolutely clear," he said, adding that his case had been "rushed there without proper investigation".
"Just as the ICC failed me, it has also failed the victims of the 2007-2008 post-election violence," Mr Kenyatta said.
"They were killed, maimed, displaced, dispossessed and utterly traumatised. I have been victimised, libelled and senselessly profiled by the same defective process."
Kenyan Foreign Minister Amina Mohamed said her government would try to have two other similar cases thrown out including one involving Deputy President William Ruto.
"As they say, one case down, two more to go," Mr Kenyatta said on Twitter.
He has denied inciting ethnic violence following the disputed 2007 elections in order to secure victory for then-President Mwai Kibaki.
Mr Kenyatta won Kenya's presidential elections in 2013 with the backing of Mr Kibaki, rallying nationalist support by accusing the Dutch-based court of meddling in Kenya's affairs.
Analysis: Dennis Okari, BBC Africa, Nairobi
Over the last six years, ICC cases have become a political chess game in Kenya. When Uhuru Kenyatta and one-time rival William Ruto joined forces to win elections last year, they decided to play the issue to their advantage.
The bitter rivalry between their communities, which often degenerated into violent clashes, was forgotten. The two had a clear message, one of galvanising the country to forgive and forget the past.
But the overriding factor was that they were victims of an international process - as Mr Ruto, too, was accused of orchestrating the violence that followed the elections in 2007 when they had been on opposing sides.
With the dropping of the charges against Mr Kenyatta, some of the victims may feel it makes a mockery of justice.
But the two politicians are sticking together. Deputy President William Ruto tweeted: "The truth has set you free," and Mr Kenyatta called him "indispensable", saying he looked "forward to the day when we shall not have the distractions of the trials, so that we can continue delivering our transformational agenda to the people of Kenya".
However, this romance is glued together by the ICC, and analysts say if Mr Ruto is not vindicated by the court, where his trial is ongoing, then a political storm may determine the future of Kenya.
He was the first head of state to appear before the court, after he was charged in 2012.
The prosecution repeatedly asked for more time to build its case, saying witnesses had been bribed and intimidated, and the Kenyan government had refused to hand over documents vital to the case.
On Wednesday, the ICC gave prosecutors a week to decide whether to pursue their case or withdraw charges, saying further delays would be "contrary to the interests of justice".
But on Friday prosecutors said the evidence had "not improved to such an extent that Mr Kenyatta's alleged criminal responsibility can be proven beyond reasonable doubt".
The BBC's Anna Holligan in The Hague said the decision was a huge blow to prosecutors.
Many observers had seen the case against Mr Kenyatta as the biggest test in the court's history, she says.
The main prosecutor, Fatou Bensouda, made plain her dismay at having to withdraw charges, saying there had been "a steady and relentless stream of false media reports... an unprecedented campaign on social media to expose the identity of protected witnesses [and] concerted and wide-ranging efforts to harass, intimidate and threaten individuals who would wish to be witnesses".
She said the case had required the help of the Kenyan government, but this was "not provided".
- Born in 1961, became Kenya's youngest president
- Son of the country's first president, Jomo Kenyatta
- Heir to one of the largest fortunes in Kenya, according to Forbes magazine
- Entered politics in 1990s, groomed by ex-President Daniel arap Moi
- Lost presidential race in 2002 by a large margin to coalition led by Mwai Kibaki
- Backed Mr Kibaki for re-election in 2007
- Married father of three
- Hobbies: Football and golf
Human Rights Watch, which has accused the Kenyan government of acting as a roadblock, said: "It's clear that a long tradition of impunity in Kenya and pressure on witnesses have been serious obstacles to a fair process before the ICC."
Fergal Gaynor, a lawyer who represents victims of the violence, told the BBC's Focus on Africa programme that there was a "widespread feeling of disappointment" at the dropping of charges.
About 1,200 people were killed in the violence in 2007-8 and 600,000 were displaced.
Mr Ruto is on trial at the ICC on similar charges to Mr Kenyatta, after his legal team's efforts to have the case thrown out failed.
He and Mr Kenyatta were on opposing sides during the 2007 election, with Mr Ruto accused of fuelling violence to bolster opposition leader Raila Odinga's chances of becoming president. He denies the charges.
Mr Ruto subsequently formed an alliance with Mr Kenyatta in the 2013 election, opening the way for him to become deputy president.