Nigerians are voting in a presidential election today. The stakes are high: the winner will take charge of Africa's most populous nation and biggest economy; they will also confront the ongoing Boko Haram insurgency that has left some 13,000 people dead since 2009, and forced more than a million from their homes.

President Goodluck Jonathan, in office since 2010, is running for a second four-year term against Muhammadu Buhari, a former military dictator. Top issues include the economy, security, and official corruption.

Regardless of who wins, it's feared the result could trigger violence by exacerbating preexisting tensions along religious and ethnic lines, which overlap with political grievances. Elections in Nigeria can be plagued by rampant vote-buying, as well as the use of political thugs to intimidate or even kill rivals and to rig ballots. Accusations of foul play will fly both ways. In Nigeria's last presidential election, in 2011, 800 people lost their lives in the clashes that followed.

That will hopefully not happen this time around, but the concern that it could is a sign of both the high stakes in the election and some of the deeper problems underlying Nigerian politics.

The leading candidates are a president with a poor record and a former dictator

There are 14 candidates on the presidential ballot, but really this is a two-man race between Jonathan and Buhari. While Nigerian opinion polls are notoriously unreliable, the figures that are available suggest it's too close to call.

Jonathan's time in office has been troubled by a weak economy, high corruption, and a badly worsening conflict with the Boko Haram extremist group based in Nigeria's predominantly Muslim north. Jonathan's critics say it has taken him years to fully take on the insurgency that has largely caused suffering to people in the predominantly Muslim north, where Jonathan, a Christian, is less popular. There are now signs that Nigerians from all ethnicities and religions, across the country, could be fed up enough to vote for the opposition.

The alternative is Buhari, whose brief military rule from 1983 to 1985 was cruel and repressive. He detained thousands of people, banned free speech, and, in one example of the indignities of life under his rule, used soldiers armed with whips to ensure that Nigerians queued for buses in an orderly fashion.

So why would people vote for Buhari? For one, Jonathan's record is poor. For another, Buhari ran a strict campaign against corruption. Nigeria is blighted by corruption on a fantastic scale: last year, the central bank chief admitted that $20 billion had gone missing from its coffers without a trace. Nigerians would dearly love to see action on the problem.

Jonathan could be the first sitting Nigerian president to be voted out of office

Nigeria is a young democracy — the country has been mostly ruled by military juntas since independence from Britain in 1960, with civilian rule only restored in 1999. This is the first time since then that an opposition candidate has had a fighting chance of unseating a sitting Nigerian president.

Nigerian politicians have often used the power of their office to sway things their way in elections. Jonathan delayed the vote for six weeks — citing security fears over Boko Haram — which his critics have alleged was meant to skew the process in his advantage.

The election could go to a runoff election. That's because a winning candidate needs not just a majority of nationwide votes but a minimum of 25 percent of the vote in two-thirds of Nigeria's 36 states.

In any case, both candidates are expected to challenge the final result if it's close, which could lead to a long, drawn-out legal battle.

It's not clear what would happen if Jonathan lost the vote, or if the results were very close. If he leaves office peacefully, it would be a major moment for Nigeria's democracy, but first-time democratic transitions can often be troubled by turbulence or even violence.

Many northerners think it's their turn for the presidency — raising the stakes if Buhari loses

Nigeria is often characterized as being sharply divided between a poorer, mostly Muslim north and an oil-rich, mostly Christian south. That's oversimplifying things — the country has an array of ethnic and religious groups mixed in across the country that don't divide along neat geographic or religious lines.

Still, it's broadly true that Jonathan, who is Christian and from the south, has his power base in the south, while Buhari, a Muslim from the north, has his up there. When Buhari ran against Jonathan in 2011, the vote generally divided along regional lines. Take a look at this map from the OECD, with Buhari's old Congress for Progressive Change party in yellow and Jonathan's People's Democratic Party (PDP) in blue:

This time around, Buhari's trying a new strategy: he's formed a new political party, the All Progressives Congress, allying his northern base with smaller opposition parties from elsewhere.

But regional politics could still come into play in this election. Because of Nigeria's turbulent history of religious and ethnic conflict, there's an informal agreement in Jonathan's PDP party — which has provided every president since civilian rule began — that the presidency should rotate between a northerner and a southerner.

It's been 16 years since Nigeria won democracy, and it's had a southerner president for 13 of those years. Many northerners feel it's time for one of their own to take charge again.

But it's more than just a matter of taking turns. There's a strong sense that the north has been marginalized under Jonathan's rule: it's much poorer, and Jonathan has appeared slow to take on Boko Haram. So the election comes at a tense time in north-south relations. There are fears that if Buhari loses, violence on the scale of the last election — or worse — could break out.

"The fault lines of region, ethnicity and religion run deep in Nigeria," Jideofor Adibe writes in a paper for the Brookings Institution. "There is a pervasive fear that the president of the country will abuse the powers of his office to privilege his region, ethnicity or religion—if not to punish or deliberately disadvantage others."

The fear of violence is not only in the north, either.

"In the Niger Delta, at the extreme southern end of the country, another security storm is brewing," writes Sola Tayo at Chatham House.

"Before the Boko Haram insurgency, the [southern region of the Niger] delta was the primary source of unrest; violence there may reignite if militants’ preferred candidates do not win. One group of former militants has threatened to wage war should Goodluck Jonathan lose the election, while another has pledged its loyalty to Buhari."

The Boko Haram insurgency could both help and hinder Jonathan in the election

Boko Haram has vowed to disrupt the election, and it's not clear how many voters in the northern states stricken by the insurgency will be willing or able to vote. That could be a boost for Jonathan, as these voters would have been much more likely to vote for Buhari.

It's not that Boko Haram supports Jonathan — they very much don't — but they oppose democracy in Nigeria itself in a way that could still help him.

Nigeria's recent battlefield victories against the group could boost Jonathan's chances by demonstrating that his government can handle national security — but his foot-dragging on the issue, and the fact that other countries have had to step in and help Nigeria's ill-equipped army, could also work against him.

"Nigerians are embarrassed that their army needed reinforcements from smaller, poorer neighbors like Chad, Niger and Cameroon to reclaim northern towns from the terrorist group," Jean Herskovits, who has been watching Nigerian politics for more than four decades, wrote in the New York Times.

Nigerians have little confidence in the elections, and that's bad news

Hardly anyone expects this vote to be entirely fair — and that in itself makes violence more likely, because it makes accusations that the vote has been rigged one way or the other more likely, and thus more able to exacerbate existing fears among Nigerians that the government does not honestly represent their interests.

In a shocking indication of just how few people expect the vote to be clean, a Gallup poll in January found only 13 percent said they had confidence in the honesty of elections.

As voting gets underway, there have already been reports of problems with the card readers that check voters' biometric ID cards, causing long delays for voters. There have also been reports of at least one suspected Boko Haram attack on a polling station in the north. If there are widespread perceptions that northern voters in particular have been forced to stay away, either through intimidation or technical problems, Buhari's supporters could argue that they were denied fair representation.

Preliminary results are expected as early as Sunday; Nigeria is in for a tense wait.