DAKAR, Senegal — A former military commander and rebel leader who later went to graduate school in the United States and Britain was declared the winner of Sierra Leone’s presidential runoff on Wednesday after a campaign season marred by reports of violence and irregularities.
The new president, Julius Maada Bio, was to be immediately sworn in on Wednesday night. The country’s chief justice, Abdulai Charm, said the inauguration needed to be held quickly to avoid a power vacuum and in compliance with the country’s Constitution.
Candidates from 16 parties ran for president, but in the first round of voting last month, no one won the 55 percent required to avoid a second round.
Mr. Bio, 53, from the Sierra Leone People’s Party, received 51.8 percent of the vote in the runoff on Saturday, narrowly defeating Samura Kamara from the governing party, the All People’s Congress, who won 48.2 percent, according to the Electoral Commission.
Mr. Bio will succeed President Ernest Bai Koroma, who is stepping down after serving a second five-year term. His tenure was punctuated by tragedy, including an outbreak of the Ebola virus and a deadly mudslide, in a country that is still recovering from a from a civil war that ended in 2002 after the deaths of more than 50,000 people.
In recent days, the candidates exchanged accusations of tribalism and even charges of attempts at “ethnic cleansing.” A former British colony, Sierra Leone, with a population of nearly seven million, has long been divided along tribal and regional lines.
Several episodes of violence were reported at political rallies this year, and at least one death and several injuries were recorded. A gunshot was heard close to Mr. Bio’s home after polls were closed on Saturday. For a time, internet service was suspended, as well as international phone service.
Andrew Lavali, the executive director of the Institute for Governance Reform, an independent research group in Sierra Leone, said the presence of heavily armed soldiers in the capital, Freetown, and elsewhere, created an atmosphere of fear and intimidation for many voters.
“The military presence was even higher than what the country had during the 1996 elections, when the country was still at war,” Mr. Lavali said.
In addition, Patrick Jaiah Kamara, a reporter for the newspaper Concord Times, complained that he and two fellow journalists were beaten and had their cameras destroyed by members of the governing party. Police officers and soldiers stood by and did not stop the attack, he said.
“My face still swollen from the beating I received and my camera was completely destroyed,” Mr. Kamara said.
The Electoral Commission had postponed the runoff after a High Court judge found irregularities in the first round of voting. And even after the runoff was held on Saturday, the outcome was delayed because of disagreements over how to count the votes.
Sierra Leone has abundant natural wealth, including diamonds, bauxite and iron ore, but the country is one of the world’s poorest, with high rates of maternal and infant mortality. Many adults make a living from activities like selling clothes along the road, pushing loads in wheelbarrows for hire and driving motorbike taxis.
Education and improved health care are needed to get the nation back on its feet. And corruption is a major challenge, according to Prof. Ibrahim Abdullah, a former professor of history and African studies at Fourah Bay College at the University of Sierra Leone.
Mr. Bio was born in the southern district of Bonthe. He joined the armed forces in 1985, and in 1987 he graduated as a second lieutenant from the country’s military academy. Three years later, Mr. Bio was part of a group of soldiers sent to Liberia as part of a contingent of Sierra Leone’s peacekeeping force.
A year later Mr. Bio and other members of the armed forces were deployed back to the south of Sierra Leone to clamp down on an insurgency by the Revolutionary United Front, which opposed the government of President Joseph Saidu Momoh.
In 1992, Mr. Bio and six other soldiers staged a coup in which they overthrew Mr. Momoh. Mr. Bio was made deputy head of state until January 1996 when he led another coup and toppled his boss, Valentine Strasser, who was made president after the 1992 coup.
Mr. Bio ruled the country for just three months and handed power over to a civilian government after elections in 1996. He resigned from the armed forces and emigrated to the United States where he lived and studied for about a decade. He later earned a master’s degree in international affairs from American University in Washington.
Mr. Bio returned to Sierra Leone in 2008 and established a cocoa and coffee farming company. In 2012 he led the Sierra Leone People’s Party as its presidential candidate, but he lost to Mr. Koroma.
He is also a senior research fellow at the University of Bradford in England, where he is pursuing a Ph.D. in Peace Studies.
Mr. Bio’s victory in Sierra Leone resembles, in some ways, that of Muhammadu Buhari, Nigeria’s president since 2015, according to Mr. Lavali. Mr. Buhari was a former military commander who led his country after a coup there.
Mr. Lavali said that military officers, including those involved in past coups, were now taking part in democratic politics and competing in elections. He called that development a transformative step for countries like Sierra Leone that have been torn by conflict.
“It shows a transition from a country where people used guns to acquire power to a level where the ballot is used to secure the mandate of the people,” Mr. Lavali said.