Kenyan MPs voted on Thursday to become the first country to pull out of the international criminal court (ICC), sending a defiant message to The Hague just months before their president is due to stand trial.

Citing the fact that the United States and other major powers were not members, the majority leader of Kenya's parliament proposed a motion for Kenya to "suspend any links, co-operation and assistance" to the court. The measure passed comfortably.

The ICC has charged Kenya's president, Uhuru Kenyatta, and the deputy president, William Ruto, with crimes against humanity, which both deny.

Ruto's trial is due to start in The Hague next week and the ICC said the cases would continue even if Kenya pulled out of the court which was established in 2002 to deal with genocide, crimes against humanity, war crimes and the crime of aggression.

A parliamentary bill for Kenya's withdrawal is expected to be introduced in the next 30 days but the final decision will rest with the government, headed by Kenyatta and Ruto.

Opponents warned that withdrawal would isolate Kenya and deal a fresh blow to the already strained credibility of the ICC.

Adan Duale, the majority leader from Kenyatta's Jubilee coalition, told an emergency session of parliament that US presidents Bill Clinton and George W Bush both argued against becoming a party to the ICC to protect US citizens and soldiers from potential politically-motivated prosecutions.

"I am setting the stage to redeem the image of the republic of Kenya," Duale said. "Let us protect our citizens. Let us defend the sovereignty of the nation of Kenya."

MPs from the opposition Coalition for Reforms and Democracy, led by former prime minister Raila Odinga, walked out of the debate, calling the motion capricious and ill-considered. Minority leader Francis Nyenze said: "We'll be seen as a pariah state; we'll be seen as people who are reactionary and who want to have their way."

Kenyatta and Ruto's charges related to the alleged orchestration of post-election violence in 2007-08 that resulted in the deaths of more than 1,100 people.

Kenyatta, who was elected president earlier this year, faces trial in November in the biggest test yet for the ICC. Both leaders have said they will co-operate with the court.

The parliamentary decision was criticised as a snub to victims of the violence. Ndungi Githuku, a political activist in the capital, Nairobi, said: "It's a sad day. They are thinking about two individuals and the cases will still go on whether we pull out or not. But it means, in future, people cannot be prosecuted by the ICC.

"The messages it's sending is that impunity is being continued: 'We are ready to do evil and human rights violations and no one is going to keep us in check.' The victims of violence in 2007-08 are the losers."

The ICC has been criticised as anti-African after prosecuting only Africans during its 11 years in existence. But Githuku added: "In parliament, they kept hammering that the ICC is colonialism coming back through the back door. I really don't think so. The ICC is there to keep everyone in check."

Njonjo Mue, a spokesman for the Kenyan section of the International Centre for Transitional Justice, said: "We think it is quite disappointing in terms of the search for justice for victims of post-election violence. Having signed the Rome statute and seen the role the ICC played in a peaceful election this year, it's a very negative message.

"The ICC still enjoys broad support among the general public so it's a bad situation. There has been no attempt to find out what the victims of post-election violence think of these cases."

The Kenyan parliament voted to withdraw from the ICC on a previous occasion but the executive branch took no action. The Rome statute that created the ICC says a "state party" may withdraw with written notification to the UN's secretary-general and the decision takes effect one year later.

"There is still the possibility that the executive could reject the vote," Mue said. "The focus is squarely on the president right now and he has pledged to co-operate with the ICC."

Kenyatta and Ruto, bitter opponents in the 2007 election, joined forces in March this year and won with 50.03% of the vote. Many felt the ICC charges helped rather than hindered their campaign, allowing them to exploit anti-western sentiment.

The US had said a Kenyatta win would have "consequences" and, when president Barack Obama undertook on a tour of Africa in June and July, he did not visit his ancestral home.

Many in Africa remain suspicious of the ICC, although it has been ratified by 34 Africa countries. In May, Ethiopian prime minister Hailemariam Desalegn accused it of racist bias and "hunting Africans". At Kenyatta's inauguration in April, Uganda's president, Yoweri Museveni, said of the court: "They are now using it to install leaders of their choice in Africa and eliminate the ones they do not like."