ABUJA, Nigeria – Boko Haram extremists killed 41 people, including a legislator, and scared hundreds of people from polling stations in the northeast, but millions voted across Nigeria Saturday in the most closely contested presidential race in the nation's history.
In electoral violence elsewhere, three people including a soldier were shot and killed in political thuggery in southern Rivers state, and two car bombs exploded at polling stations in the southeast but no one was injured, according to police.
All the Boko Haram attacks took place in northeastern Nigeria, where the military Friday announced it had cleared the Islamic extremists from all major centers, including the headquarters of their so-called Islamic caliphate.
Nearly 60 million people have cards to vote, and for the first time there is a possibility that a challenger can defeat a sitting president in the high-stakes contest to govern Africa's richest and most populous nation.
The front-runners among 14 candidates are President Goodluck Jonathan, a 57-year-old Christian from the south, and former military dictator Muhammadu Buhari, 72, from the predominantly Muslim north.
Voters also are electing 360 legislators to the House of Assembly, where the opposition currently has a slight edge over Jonathan's party. Voting for 13 constituencies was postponed until April because of shortages of ballot papers, electoral officials said.
Nigeria's political landscape was transformed two years ago when the main opposition parties formed a coalition and for the first time united behind one candidate, Buhari. Dozens of legislators defected from Jonathan's party.
Polling will continue Sunday in some areas where new machines largely failed to read voters' biometric cards, said Kayode Idowu, spokesman of the Independent National Electoral Commission. That includes some areas of Lagos, a megacity of 20 million and Nigeria's commercial capital on the Atlantic coast.
Even the president was affected. Three newly imported card readers failed to recognize the fingerprints of Jonathan and his wife. Biometric cards and readers are being used for the first time to discourage the kind of fraud that has marred previous votes.
Afterward, Jonathan wiped sweat from his brow and urged people to be patient as he had been, telling Channels TV: "I appeal to all Nigerians to be patient no matter the pains it takes as long as if, as a nation, we can conduct free and fair elections that the whole world will accept."
Nigerians exercised extraordinary restraint, waiting hours in heat that rose to 100 degrees (37 degrees Celsius) in some places. Many remained for more hours after voting ended to witness the ballot count, determined to do their part to try to keep the elections honest.
Vote counting ended Saturday night in some areas, with blackouts that are routine forcing some officials to count by the light of vehicles and cellphones.
Earlier, before dawn, Boko Haram extremists invaded the town of Miringa in Borno state, torching people's homes and then shooting them as they tried to escape the smoke. Twenty-five people died in the attack, Borno state Gov. Kashim Shettima told a news conference in the city of Maiduguri.
"They had sent messages earlier warning us not to encourage democracy by participating in today's election," said Mallam Garba Buratai, a Miringa resident who witnessed the attack.
Nigeria's home-grown Islamic extremists say democracy is a corrupt Western concept and point to the endemic corruption as a reason to do away with it in favor of an Islamic caliphate.
Another 14 people were killed in extremist attacks on the town of Biri and Dukku, in Gombe state, according to police and local chief Garkuwan Dukku.
Among the dead was a Gombe state legislator, Umaru Ali, said Sani Dugge, the local campaign director for the opposition coalition.
Two voters were killed in Boko Haram attacks on polling stations in the twin Gombe towns of Birin Bolawa and Birin Fulani, according to police. Witnesses said the gunmen yelled that they had warned people to stay away from polling.
In four other northeast towns in Yobe state, gunmen drove in and fired into the air, frightening people to flee into the bush and disrupting any voting, police said.
Thousands of people, among more than 1.5 million forced from their homes by the Islamic uprising, lined up to vote at a refugee camp in Yola, capital of northeast Adamawa state and home to as many refugees as its 300,000 residents.
Refugee Elzubairu Ali does not know when she will be able to return to her home.
"We have to wait for the time when the Nigerian army will totally wipe them (Boko Haram) out before we can go back," she said after voting.
The failure of Jonathan's administration to curb the insurgency, which killed about 10,000 people last year, has angered Nigerians in the north.
International outrage has grown over another failure -- the inability to rescue 219 schoolgirls kidnapped by Boko Haram nearly a year ago. The extremists have abducted hundreds more people since then, using them as sex slaves and fighters.
Nervous foreign investors are watching as Nigeria is Africa's largest destination for direct foreign investment though its oil-dependent economy is hurting from slashed petroleum prices.
The Islamic uprising has exacerbated relations between Christians like Jonathan, who dominate the oil-rich south, and Muslims like Buhari, who are the majority in the agricultural and cattle-herding lands of the north. The population of 170 million is almost evenly divided between Christians and Muslims.
Some 1,000 people were killed in rioting after Buhari lost to Jonathan in the 2011 elections. Thousands of Nigerians and foreign workers have left the country amid fears of post-election violence.
In 2011, there was no doubt that Jonathan had swept the polls by millions of votes.
Now the race is much closer. Results are expected 48 hours after voting ends. If no clear winner emerges, a runoff will be held.