Sierra Leone has been declared Ebola-free by the World Health Organisation, prompting nationwide celebrations tinged with sadness over the loss of 4,000 victims to the disease.

The capital Freetown was transformed into a giant carnival on Friday night as ecstatic crowds took to the streets in an emotional outpouring.

The relief that the 17-month nightmare was virtually over was reflected in candle-lit prayers and spontaneous parties. In a low-key ceremony in the capital on Saturday morning, the WHO country director, Anders Nordström, confirmed 42 days had passed without any new cases, thereby satisfying criteria that transmission of the virus has ended. But while the atmosphere overnight was jubilant, there was also nervousness over the continuing outbreak in neighbouring Guinea, where four new cases were recorded over the past fortnight. In a grim reminder of how Ebola cuts through families, all four are children of a mother who contracted the disease from a relative and died. An overnight vigil was held in Freetown for the 3,955 who died, including 221 health workers. Eleven doctors died in the country, which had just 120 for 6 million people.

“There are mixed emotions,” said Marto Lado, the infectious diseases consultant at the Connaught hospital in Freetown. “Everyone is celebrating, but the truth is I’m surprised at the normality of everything.

“On Friday people came to work and were talking about it, but not in an excited way. It’s more of a relief, people thinking: ‘Oh my God, I can’t believe we have got here.’ It has taken so long for this weekend to arrive. There is still a lot of anxiety about what might happen. There is still Ebola in Guinea and we know it is not over yet.”

Ebola survivors and the bereaved, which include an estimated 12,000 orphans, were subdued.

Dauda Fullah, 25, an Ebola survivor, who lost five members of his family, said there would be street carnivals all day in the city of Kenema.

“We are happy that this day has come, but we are not rejoicing because we have felt the destruction to our lives,” he said. “The only thing I am doing is taking my family and saying a prayer for my parents and brothers and sisters who died.”

Mohamed Kamara, 23, who lost three of his family and whose 19-year-old wife Aminata lost six of hers, said: “I feel really happy about today. I’m sad for the family that I lost, but I am happy for the end of Ebola. I pray that we don’t ever have this sickness in our country again.”

Syerramia Willoughby, the daughter of the country’s most senior doctor to have been killed by Ebola, Victory Willoughby, said: “The sadness stays with you for a long time. It’s really good to see Ebola has retreated, but my concern is that we will have more cases because it is not yet eliminated in Guinea.”

Saturday’s announcement marks the official end of a battle that was prematurely thought to have been nearing its conclusion on previous occasions.

Ebola spread to Sierra Leone in May 2014, when a young pregnant woman and an older housewife were diagnosed as the country’s first cases. Bothattended the funeral of a widely respected faith healer who had been attending to sick patients in a village a few hours’ walk from Gueckedou in Guinea, where the outbreak began.

At the peak of the outbreak in 2014, Sierra Leone was reporting hundreds of new cases a week, with curfews and bans on market trading and public gatherings including football and cinema going.

While the primary cost of the outbreak has been in human life, the crisis has also wiped out development gains in Sierra Leone, which was devastated by 11 years of civil war ending in 2002.

The World Bank estimates that Sierra Leone will lose at least $1.4bn in forgone economic growth in 2015 as a result, leading to an “unprecedented” GDP contraction of more than 20%.