Gangs armed with machetes, knives and bows and arrows carried out four separate attacks on voting centres close to the country’s Indian Ocean coast.

News of the raids, soon after midnight on Monday, did not deter millions of voters from leaving home well before dawn. Lines of people hundreds of feet long formed in the dark before the ballot’s official start at 6am.

Close to 100,000 soldiers, police officers, prison guards and reservists were stationed at 33,400 polling stations across the country, and patrolled potential flashpoints. There had been fears of a repeat of violence in 2007, which sparked six weeks of violence that left 1,100 people dead and 600,000 forcibly evicted from their homes.

Masaai women line up at dawn to vote in a general election. Picture: AP

The only significant eruptions of violence were the coast attacks, which police blamed on the secessionist Mombasa Republican Council.

Its members last week warned The Daily Telegraph that they were “prepared” violently to disrupt the elections.

Nine police officers and one wildlife warden drafted in to protect the were killed in Mombasa, Kenya’s second city, and close to the popular beach towns of Malindi and Kilifi. Two civilians and four gang members also died.

A spokesman for the MRC denied involvement. The group is campaigning for coastal Kenyans to boycott the vote and instead agitate for secession.

A dozen people contacted by The Daily Telegraph across Kenya said that the process was peaceful, but many reported problems with a new computerised voter identification system.

Peter Mwangi, whose grandmother died in a fire at a church started by supporters of rival politicians after the last election, said there was “no tension” at home in Kiambaa, 190 miles northwest of the capital, Nairobi.

“The only problem is that this thing is complicated,” he said. “People are taking long to vote, and the machines are causing problems. People don’t understand exactly what they are doing.”

This is Kenya’s most complicated, and expensive, general election at £170 million. The 14.4 million voters yesterday chose from 12,461 candidates for six elective positions, from president to local assemblymen.

Kennedy Omondi, 31, was the first voter into Polling Station No 6 at the Olympic Secondary School in Kibera, one of Nairobi’s largest shanty towns.

The thumbprint voter registration system failed to recognise him, despite millions of pounds spent on its development. Mr Omondi was eventually manually identified.

Within five minutes however he had marked all six ballot papers, slotted them into the clear plastic locked ballot boxes, and was ready to leave for work.

“Voting to me is the thing that makes all Kenyans equal,” he said. “Whether you are a rich man or a poor man, everyone has one vote. It is our right as Kenyans.”

Both leading presidential candidates, Raila Odinga, 68, the prime minister, and Uhuru Kenyatta, 51, the former finance minister, made eleventh-hour appeals to ensure their supporters voted.

A quick count at five polling stations in Nairobi estimated turnouts mostly above 85 per cent, which would be Kenya’s highest ever.

Counting began on Monday evening, and a result was expected on Tuesday or Wednesday. Despite peaceful voting, there were still concerns that any suggestion the final result was not fair could cause chaos.

Mr Odinga’s camp has accused government officers of illegally backing his rival. Mr Kenyatta himself faces charges at the International Criminal Court, which he denies, over his alleged role in the post-election violence in 2007 and 2008.

Christabel Anyona, who works for a health charity, said she was worried.

“I’m not confident that people have learned anything after the last election,” she said after waiting three hours to vote at Kilimani Primary School in a middle-class suburb of Nairobi.