Two Kenyan presidential hopefuls will stand trial accused of orchestrating violence that left more than 1,200 people dead after elections in 2007, the international criminal court (ICC) has ruled.

The deputy prime minister, Uhuru Kenyatta, and the former education minister, William Ruto, are accused of crimes against humanity, including murder and persecution.

They will be tried along with Francis Muthaura, who is head of the civil service and cabinet secretary, and Joshua arap Sang, a radio presenter.

The four men will remain free in Kenya until the case begins, but Judge Ekaterina Trendafilova warned that they could face arrest if they tried to whip up fresh violence.

"The chamber found that the prosecutor has established substantial grounds to believe that the crimes against humanity of murder, deportation or forcible transfer and persecution were committed," Trendafilova said about the charges against Ruto and Sang.

"These crimes resulted in the deaths of hundreds and displacement of thousands of civilians," she added.

Ruto – who like the five other accused has claimed innocence – immediately said he would run for president despite the ruling.

"This is to confirm I am firmly in the race. Let us meet at the ballot," Ruto told a news conference in Nairobi.

Charges against two other men, the former police chief Mohammed Hussein Ali and the ex-minister for industrialisation Henry Kosgey, were dropped because of insufficient evidence.

The violence began after the 2007 election when clashes between supporters of two rival presidential candidates – Raila Odinga and Mwai Kibaki – escalated into bloody communal conflict.

More than 1,200 people were killed in weeks of unrest and about 600,000 were forced to flee their homes.

The ICC said victims would have the right to seek reparations if the accused were convicted.

The chief prosecutor, Luis Moreno-Ocampo, has asked to bring two separate cases, reflecting the ethnic divisions behind Kenya's post-election violence.

Kenyatta, 50, is the son of Kenya's first president and the country's richest citizen, with a personal fortune of $500m (£321m).

A supporter of Kibaki, he is accused of organising a campaign of violence including murder and rape against Odinga supporters.

The ruling was welcomed by human rights groups. "Today's decisions move forward the search for justice for those who lost their lives and their homes in Kenya's 2007-2008 election violence," Human Rights Watch said. "The ICC trials will break with decades of impunity in Kenya for political violence, but Kenya should act to widen accountability by carrying out prosecutions at home."