A former military commander and coup leader was declared the winner of Sierra Leone’s presidential runoff.

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.

Mr. Bio succeeds President Ernest Bai Koroma, who is stepping down after serving a second five-year term.