President Mwai Kibaki was trying to fend off a fiery opposition leader in the closest presidential race in the country's history, with voting Thursday following weeks of violence and allegations of rigging.
Corruption and voter intimidation have been central themes in the campaigns, with Kibaki and Raila Odinga vowing to end the graft that has scared off foreign investment and cost taxpayers millions of dollars.
"This time around, Kenyans are not the same," said Harun Owade, a 30-year-old mechanic who had been in line since 3:30 a.m. in Kibera, one of Africa's largest slums and Odinga's main constituency.
"We cannot be tricked," Owade said. "We will put the politicians to the test."
Early Thursday, Odinga said he and others couldn't vote because their names were not on the register in Kibera, although an Associated Press reporter saw his name listed there. He voted a few hours later.
Alexander Graf Lambsdorff, chief European Union election monitor in Kenya, asked that the voting hours be extended by at least two hours because of the confusion in Kibera, which is home to at least 700,000 people in a maze of potholed tracks and ramshackle dwellings. Young men were smashing windows, saying they also were not listed on the voting register.
"There are so many people, and we want to make sure everybody has the opportunity to exercise their democratic right to vote," Lambsdorff said.
Some 30,000 foreign and national observers are monitoring the vote.
On the eve of the vote, authorities said opposition supporters had stoned three police officers to death in western Kenya, accusing them of being part of a government conspiracy to rig the elections. Kibaki has denied all allegations of rigging.
In 2002, Kibaki unseated the party that ruled Kenya for nearly four decades, running on an anti-corruption campaign. Some Kenyans were so emboldened by his victory they started making citizens' arrests of police who demanded bribes. But while he has been credited with helping boost this East African nation's economy, his anti-graft campaign has been seen as a failure.
In Kibaki's hometown of Othaya, some 200 kilometers (125 miles) from the capital, Nairobi, the incumbent appeared confident of another five years in office.
"These remaining five years let us work hard to finish the work that is left out," Kibaki said after casting his vote with his wife and three children. "I wish to serve another five years, then my time will be over."
His supporters turned out in droves, cheering the president and shaking his hand at the polling station.
"I have not even milked my cow because today we are putting our country first," Mary Muthoni Gikiri said.
Odinga, a former political prisoner under Kibaki's predecessor Daniel arap Moi, casts himself as a candidate of change. But he has been accused of failing to do enough to help his constituents during 15 years as a lawmaker.
With its Indian Ocean beaches, fabled game parks and booming tourism industry, Kenya in many ways is flourishing.
The country is leading projects to link eastern Africa with Europe with a high-tech undersea telecommunications cable, and a French-led consortium recently won a bid to buy 51 percent of the state-owned telecommunications company.
But the benefits for Kenyans, and the attractions for foreigners, are undermined by corruption.
For many observers, however, the very fact that the race is a toss-up is a sign of how far Kenya has come in 15 years of multiparty democracy. An incumbent has never before faced a credible challenge.
When Kibaki ran in 2002, Moi was constitutionally barred from extending his 24 years in power. Moi won in 1992 and 1997 in elections marked by allegations of vote-rigging.
Kenyans also were electing 210 members of parliament and more than 2,000 local councilors Thursday. The polls close at 5 p.m. The first official results were expected Friday afternoon.
To win, a presidential candidate has to get the most votes as well as garner at least 25 percent of votes in five of Kenya's eight provinces. Different provinces tend to be dominated by different tribes, so the rule adopted when multiparty politics were ushered in in 1992 was aimed at ensuring a president has some support in most of the country. Since some tribes are larger than others, a first-past-the-post system would usually mean members of larger tribes would win and not have to seek support of other tribes.
Both Kibaki and Odinga are from major tribes, Kibaki from the Kikuyu and Odinga from the Luo.
Associated Press Writers Elizabeth A. Kennedy, Katharine Houreld, Tom Odula and Malkhadir M. Muhumed contributed to this report from Nairobi, Kenya.