Africa's most populous country has emerged from a history of military rule to a democracy, in which more freedom has led to outbreaks of religious and ethnic violence.
Nigerian population counts have a history of being controversial, violent, with allegations of rigging and manipulation. The census in 2006 was mainly peaceful, but there were outbreaks of violence - including a number of deaths - and heightened ethnic and political tensions.
The 1991 census put the total population at 88.9m, almost equally divided between the two sexes. The 2006 census, recording a population of 140m, suggests there are 3.5m more men than women.
The census included questions on education, occupation, income, size of house,
water supply, toilet facilities, type of fuel used and access to radio, television and telephones - but, in an effort to avoid trouble, not religion.
Religious and ethnic groups were concerned that the results of a census which included religion could affect their position in society, government funding, and political influence in the region.
Muslims are in the majority in most of the northern states which have adopted Sharia (Islamic) law. Kaduna and Niger do operate under Sharia, but are often described as 50% Christian and 50% Muslim.
More central states are also a mix of Christian and Muslim, and the southern states are mostly Christian and animist.
Nigeria is the economic powerhouse of West Africa, contributing nearly 50% of regional GDP. Economically, Nigeria remains dependent on the oil and gas sector. Nigeria is a member of Opec and is the world's eighth largest exporter of oil. Revenue from Nigeria Liquefied Natural Gas Limited (NLNG) is expected to surpass oil revenues over the next 10 years.
Although the type of crude oil produced in Nigeria needs little refining, Nigeria has been unable to get its own refineries working to the point where it can produce petroleum products for domestic consumption and has to re-import refined products.
Increasing lawlessness in the oil-producing Niger Delta region had cast doubt over whether an election could be staged at all in Rivers, Delta and Bayelsa states. In the past 12 months, more than 100 foreign workers have been kidnapped (70 in 2007 so far) and attacks on oil facilities have forced Nigeria to shut down between 20-25% of its oil production.
A booming industry has been the mobile phone sector. There are approximately 1.25m landlines in Nigeria, whereas there are estimated to be more than 30m mobile phone subscribers. Analysts believe that growth will continue, with Nigeria overtaking South Africa to become Africa's largest market by the end of 2007.
During President Olusegun Obasanjo's two terms of office, Nigeria has paid off all but $5bn of an estimated $35.9bn foreign debt. Following a debt deal with the Paris Club (government-to-government creditors) in 2005, Nigeria paid back $12.4bn in April 2006. It is due to repay $900m to the London Club (private financial institutions) soon, having already repaid $1.4bn.
Its remaining creditor, the World Bank, says the repayment record on the $2.07bn lent to Nigeria is "very good".
But Transparency International still ranks Nigeria as one of the world's most corrupt countries. Law enforcement officials say almost half of its $40bn annual oil revenue is stolen or wasted.
Nigeria has been ruled by the military for most of the 47 years since independence from Britain.
After the past eight years of democracy there are now more than 50 parties across the country. The main ones are the ruling People's Democratic Party (PDP) and the opposition All Nigeria People's Party (ANPP) and Action Congress (AC).
President Olusegun Obasanjo - an ethnic Yoruba and Christian from the South - is a veteran of the military and political elite. He has won some praise abroad as he is credited with tackling the foreign debt and corruption that were crippling the economy.
But many Nigerians complain they have yet to see any major improvements in the basic infrastructure - power, water and utilities - or in their prospects of getting a job, while prices keep on going up.
After Mr Obasanjo's election in 1999, a new constitution provided for elections every four years. Mr Obasanjo won again in 2003, although the polls were considered flawed. The governing People's Democratic Party (PDP) strengthened its position in both the National Assembly and across Nigeria's 36 states, 31 of which have PDP governors.
Umaru Yar'Adua - PDP - current state governor (left)
Atiku Abubakar - AC - current vice-president (centre)
Muhammadu Buhari - ANPP - Former military leader (right)
An attempt to amend the constitution to allow the president to stand for a third term failed in 2006.
The 2007 elections should see the first civilian-to-civilian transfer of power in Nigeria since independence.
The three main presidential contenders are all northern Muslims, reflecting a belief that Nigeria's top job should be held by a northerner, after Mr Obasanjo.
Atiku Abubakar wants to stand on behalf of the Action Congress. After lengthy court battles it looks like he will be running.
A notable achievement over the past eight years is that the army has been politically neutralised - any generals with political ambitions were quickly retired, others have been regularly rotated to prevent them building any constituency within the military. The new generation of officers see themselves as professionals and, for the first time in decades, all observers agree that a military coup is unlikely.
Regionally, Nigeria is the predominant power in West Africa and was instrumental in setting up the Economic Community of West Africa (Ecowas) under which it has taken the lead in regional conflict resolution, principally in Liberia and Sierra Leone.
Benin, Burkina Faso,
Gambia, Ghana, Guinea,
Guinea-Bissau, Liberia, Mali,
Niger, Nigeria, Senegal,
Sierra Leone, Togo
On the wider stage, President Obasanjo was one of the founders of the New African Partnership for Development (Nepad) and held the chair of the African Union (AU) in 2005-6, hosting peace talks for Sudan. Nigeria aspires to a permanent seat on the UN Security Council.
Nigeria has some of the worst social indicators in the world: one in five children die before the age of five; 12 million children are not in school; and there are nearly two million Aids orphans.
More than 54.7% of the population (75 million people) live below the poverty line in a country where the life expectancy is 47.
Eight years after the introduction of the president's privatisation programmes, Nigerians are still waiting for a guaranteed electricity supply, running water, sewerage services, improved rail and road services and telephone facilities.
The capital, Abuja, is Nigeria's most expensive city, followed by the oil-rich Port Harcourt and then the largest city Lagos, the country's commercial capital.
In May 2004, Mr Obasanjo introduced a home-grown economic reform programme named the National Economic Empowerment and Development Strategy (Needs) which is intended to promote fiscal discipline and due process in public procurement, reform the civil service and banking system and introduce privatisation and transparency.
Human rights have improved considerably since 1999, though Nigeria still retains the death penalty. The Obasanjo government set up the Oputa Panel to investigate human rights abuses under the military, and established a Human Rights Commission.
There is a large and active civil society and a free and vibrant media. However, there are reports of torture, beatings and extra-judicial killing, largely blamed on ill-trained members of the security forces.