Nigeria was declared free of the deadly Ebola virus on Monday after a determined doctor and thousands of officials and volunteers helped end an outbreak still ravaging other parts of West Africa and threatening the United States and Spain.

Caught unawares when a diplomat arrived with the disease from Liberia, authorities were alerted by Doctor Ameyo Adadevoh, who diagnosed it, kept him in hospital despite protests from him and his government and later died from Ebola herself.

They then set about trying to contain it in an overcrowded city of 21 million where it could easily have turned a doomsday scenario if about 300 people who had been in direct or indirect contact with him not been traced and isolated.

"This is a spectacular success story," Rui Gama Vaz from the World Health Organization (WHO) told a news conference in the capital Abuja, where officials broke into applause when he announced that Nigeria had shaken off the disease.

"It shows that Ebola can be contained, but we must be clear that we have only won a battle, the war will only end when West Africa is also declared free of Ebola."

This year's outbreak of the highly infectious hemorrhagic fever thought to have originated in forest bats is the worst on record.

The virus has killed 4,546 people across the three most-affected countries, Liberia, Guinea and Sierra Leone and travelers have from the region have infected two people in Texas and one in Madrid.

It was imported to Nigeria when Liberian-American diplomat Patrick Sawyer collapsed at the main international airport in Lagos on July 20.

Airport staff were unprepared and the government had not set up any hospital isolation unit, so he was able to infect several people, including health workers in the hospital where he was taken, some of whom had to restrain him to keep him there.

Lagos, the commercial hub of Africa's most populous nation, largest economy and leading energy producer, would have been an ideal springboard for Ebola to spread across the country.

"Nigeria was not really prepared for the outbreak, but the swift response from the federal government, state governments (and) international organizations ... was essential," said Samuel Matoka, Ebola operations manager in Nigeria for the International Federation of Red Cross and Red Crescent Societies (IFRC).

The U.S. Centers for Disease Control and Prevention, which was involved in managing the outbreak, said officials and volunteers reached more than 26,000 households of people living around the contacts of the Ebola patients.

President Goodluck Jonathan urged Nigerians to "replicate the unity of purpose and all-hands-on-deck approach adopted against Ebola in other areas of national life".

"Nigeria’s globally-acclaimed success against Ebola is a testimony to what Nigerians can achieve if they set aside their differences and work together," a presidential statement said.

"STAND YOUR GROUND"

Adadevoh, doctor on call at the First Consultants hospital in Lagos where Sawyer was brought, prevented the dying man from spreading it further, Benjamin Ohiaeri, a doctor there who survived the disease, told Reuters.

Ebola is much more contagious once symptoms become severe.

"We agreed that the thing to do was not to let him out of the hospital," Ohiaeri said, even after he became aggressive and demanded to be set free.

"If we had let him out, within 24 hours of being here, he would have contacted and infected a lot more people."

Sawyer was reported only to have malaria, Ohiaeri said. But Adadevoh noticed he had bloodshot eyes and was passing blood in his urine -- telltale signs of hemorrhagic fever. She left instructions by his bed that under no circumstances should anyone let him leave.

At one point, Sawyer ripped off his intravenous tube and a nurse had to put it back, according to a source close to the hospital staff. She later got infected and died. Sawyer then became aggressive and had to be physically restrained.

Ohiaeri said a Liberian government official on the phone had even threatened negative consequences if they did not release Sawyer, saying that holding him was tantamount to kidnapping.

"The lesson there is: stand your ground," he said.

Once the hospital contacted the ministries of health in the state of Lagos and the federal ministry in Abuja, authorities quickly set up and equipped an isolation unit.

Lagos state governor Babatunde Fashola rushed back from a pilgrimage to Mecca to handle the crisis, Ohiaeri said.

Nigeria used an existing health surveillance system for Polio for contact tracing, so was able to trace and isolate Sawyer's primary and secondary contacts quickly. Mobile technology meant live updates could be made to the contact list.

"Everyone played their part. We're so proud," Ohiaeri said.

IFRC's Matoka said contact tracing of suspected cases was key to preventing the disease from spreading into communities where it would have been harder to control.

"It was effective in identifying all suspected cases and keeping watch on them before they developed symptoms and infect other people. We were able to remove people from communities once they showed symptoms and (before they) infect many others," he said.

Even when the virus found its way to the oil hub of Port Harcourt in the southeast, authorities were able to quickly contain it, an example WHO said others should be able to follow.

"If a country like Nigeria, hampered by serious security problems, can do this ... any country in the world experiencing an imported case can hold onward transmission to just a handful of cases," WHO Director Margaret Chan said in a statement.

For the three impoverished countries at the epicenter of the crisis it is a different matter. According to consultancy DaMina Advisors, Nigeria has one doctor per 2,879 people compared with one per 86,275 in Liberia. [ID:nL2N0QI01Y]

Nigeria's success in preventing the spread of the disease contrasts with its slower and more fractious response to crises such as the kidnapping in April of more than 200 girls still being held by Islamist militant group Boko Haram.

"The approach to Ebola was pragmatic, patriotic and non-partisan," said Lagos-based political analyst and lawyer Emekanka Onyebuchi.

"They put the nation first and this is what we should have done in other areas, like the (kidnapped) girls."

The cooperation between the central government in Nigeria and the opposition-led administration in Lagos state contrasts with the United States, where bickering between Republican and Democrat lawmakers over Ebola has eroded public trust.

Alex Okoh, Nigeria's director of Port health services, said the lesson the United States and other countries can learn from Nigeria is to "put aside the political barriers and focus on the issues at hand".

Senegal, where one case was imported from Guinea, was declared Ebola-free on Friday.

Officials hope such success stories will change the way the West, where many are currently in the grip of a panic about a disease brought to their shores from "Africa", sees the crisis.

"There is focus on the worst-case scenarios, which again perpetuate the wrong, negative image of Africa as opposed to looking at some of the areas where there has been success," said Abdul Tejan-Cole, a Sierra Leonean who is executive director of the Open Society Initiative for West Africa.