A gang of machete-wielding Kenyan secessionists hacked to death at least 12 police officers while Kenyan voters formed long queues to vote in a presidential election.

The 200-strong group, armed with guns, machetes and bows and arrows, killed at least nine security officers in the coastal region a few hours before polls opened. One assailant was killed.

A second attack by the same militants, the so-called Mombasa Republican Council, killed a police officer in Kilifi. A total of seven people died in that assault, including an election official.

Candidates have urged a calm election. Prime Minister Raila Odinga called the killings a "heinous act of aggression" while deputy prime minister Uhuru Kenyatta said he was discouraged by the news.

"Never before have Kenyans turned up in such numbers," he said. "I'm sure they're going to vote for change this election."

"People with ill intent must be stopped by all means," Inspector General David Kimaiyo said.

The election has been called the country's most important and complicated in its 50-year history. In 2007, 1,100 people were killed and more than 600,000 displaced in political violence that marked the contested re-election of President Mwai Kibaki.

The chairman of the Independent Electoral and Boundaries Commission, Ahmed Issack Hassan, appealed to voters not to be intimidated by the violence.