COLOMBO, Sri Lanka — Gotabaya Rajapaksa declared victory on Sunday in Sri Lanka’s presidential election, signaling the return to power of a divisive family credited for ending the country’s long civil war through brutal means.

Mr. Rajapaksa defeated his closest opponent, Sajith Premadasa, by about 10 percentage points, according to an official tally from Sri Lanka’s election commission. His party expects him to be sworn into office early this week.

“As we usher in a new journey for Sri Lanka, we must remember that all Sri Lankans are part of this journey,” Mr. Rajapaksa wrote on Twitter in his first remarks about the victory. “Let us rejoice peacefully, with dignity and discipline in the same manner in which we campaigned.”

During the election, Mr. Rajapaksa, 70, a former wartime defense chief nicknamed “Terminator” by his family, capitalized on public outrage at the current government’s mishandling of intelligence reports warning of terrorist attacks in Sri Lanka, a lush island at the foot of India. In April, a Muslim militant group claiming loyalty to the Islamic State killed hundreds of people in coordinated suicide bombings at churches and hotels on Easter Sunday.