GENEVA — The World Health Organization declared the West African nation of Senegal to be free of Ebola on Friday, a rare success in dealing with a deadly virus that has rampaged uncontrolled in neighboring countries and prompted alarm around the world.

Senegal’s achievement came as the health organization was reported to have internally acknowledged its own stark failure to arrest the disease months ago. The internal document reportedly went far beyond the self-criticism that organization officials have expressed publicly about their response.

The W.H.O. announcement on Senegal officially concluded a monitoring period of 42 days, twice the maximum incubation period for the virus, in which no new infections were found. The last recorded case in the country was a young man who was entering by road from Guinea; he recovered and returned to Guinea last week, the organization announced.

In what would be another conspicuous success, Nigeria, Africa’s most populous nation, appeared close on Friday to declaring itself free of Ebola as well. The country would reach the 42-day milestone on Monday, after an outbreak that infected 20 people and resulted in eight deaths.