DAKAR, Senegal — A former military commander and coup 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 winner, Julius Maada Bio, was immediately sworn in as the country’s president on Wednesday night. The country’s chief justice, Abdulai Charm, said the inauguration needed to be held quickly to avoid a power vacuum and was 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.