Also elected for two-year terms starting on January 1 were Croatia, which defeated the Czech Republic in a contested race for an East European seat, and Costa Rica, which beat off a challenge from the Dominican Republic for a Latin American place.
 
At stake, like every year, were five of the 10 non-permanent seats on the 15-nation council which wields the power to send peacekeeping troops around the world and impose sanctions on countries.
 
Strength in numbers
 
Unlike the five permanent members – China, the US, Russia, Britain and France - the non-permanent members have no individual veto.
 
But an alliance of seven of them can stop a resolution even if the permanent five want it.
 
Libya, which once actively sought weapons of mass destruction and harboured or sponsored "terrorist" groups, only recently rehabilitated itself in Western eyes.
 
It was behind the 1988 bombing of Pan Am flight 103 over Lockerbie in Scotland that killed 270 people.
 
The case led to UN sanctions on Libya, which eventually turned over suspects and admitted civil responsibility.
 
Also key was a decision in 2003 by Muammar Gaddafi, Libya's leader, to abandon a weapons of mass destruction programme and the country's recent active role in the Darfur peace process.
 
Al Jazeera's correspondent at the UN, Mark Seddon, said its election to the council could be seen as a reward for good behaviour.
 
'US appeasement'
 
Alejandro Wolff, the US deputy ambassador to the UN, declined to say how he had voted, but said "the world obviously does change", and that Libya's return to the international fold was not unprecedented, citing Japan and Germany as examples.
 
Pan Am 103 victims' families said Libya's
election showed a US policy of appeasement
But he added: "I noticed that there were [Pan Am 103 victims'] family members ... in the room, and I know others were watching. Their presence was felt here today. I felt it and I know other delegations felt it."
 
Giadalla Ettalhi, the Libyan ambassador, said: "I think our relations with the United States nowadays -- they are back to normal," adding that the Pan Am affair was "behind us".
 
But Susan Cohen, whose 20-year-old daughter died in the bombing, said Libya's election showed a US policy of appeasement.
 
"I feel as if America has completely capitulated on this. Gaddafi has more blood on his hands than any surviving dictator," she said.
 
Some observers say Libya and Vietnam, which the US also used to consider an enemy, are eager to resume trade relations with the US and the West and neither are likely to take a stand on the security council that would jeopardise those ties.
 
Countries that will leave the security council on December 31 are Ghana, Peru, Qatar, Congo and Slovakia.
 
Remaining on it are Indonesia, Italy, Panama, South Africa and Belgium.