The election was relatively peaceful by the standards of Sri Lanka's fiery politics

Gotabaya Rajapaksa, who spearheaded the brutal crushing of Tamil Tigers a decade ago, stormed to power Sunday but promised to be a president for all Sri Lanka's races and religions after a divisive election.

Seven months after Islamist extremist attacks that killed 269 people, Rajapaksa was elected on Saturday on the back of a nationalist campaign promising security and to crush religious extremism in the Buddhist-majority country.

However, Rajapaksa's triumph will alarm Sri Lanka's Tamil and Muslim minorities as well as activists, journalists and possibly some in the international community following the 2005-15 presidency of his older brother Mahinda Rajapaksa.

On Sunday Gotabaya Rajapaksa, 70, thanked all voters in an election that heightened ethnic and religious tensions in a country that only a decade ago emerged from a brutal civil war that cost 100,000 lives.

"I am conscious that I am also the president of those who used the vote against me," he said as he was formally declared the hands-down winner with 52.25 percent of the vote.

"It is my duty to serve all Sri Lankans without race or religious discrimination," he said. "I promise to discharge my duties in a fair manner."

Election results showed minority Tamil and Muslim communities voting overwhelmingly for the ruling party candidate Sajith Premadasa who came a distant second with 41.99 percent.

Mahinda Rajapaksa, with Gotabaya -- nicknamed "Terminator" by his own family -- effectively running the security forces, ended a 37-year civil war with Tamil separatists.

His decade in power was also marked by alleged rights abuses, murky extra-judicial killings and closer ties with China.

"I didn't sleep all night," said student Devni, 22, one of around 30 people who gathered outside Rajapaksa's Colombo residence. "I am so excited, he is the president we need."

Premadasa, 52, of the ruling party, conceded the race and congratulated Rajapaksa and urged him to implement his manifesto promising tax cuts, free food rations and subsidies to farmers.

Rajapaksa is due to be sworn in on Monday at the ancient north-central Buddhist pilgrim city of Anuradhapura. Turnout in Saturday's vote was 83.7 percent.

- Intelligence failure -

Saturday's poll was the first popularity test of the United National Party (UNP) government of Prime Minister Ranil Wickremesinghe who is under pressure from his cabinet colleagues to step down.

Wickremesinghe's administration failed to prevent the April attacks despite prior and detailed intelligence warnings from India, according to a parliamentary investigation.

On Sunday three cabinet members resigned -- including Finance Minister Mangala Samaraweera.

Premadasa is the son of assassinated ex-president Ranasinghe Premadasa who fell victim to a Tamil rebel suicide bomber in May 1993.

But Gotabaya is adored by the Sinhalese majority and the powerful Buddhist clergy for how he and Mahinda ended the war in 2009, when 40,000 Tamil civilians allegedly perished at the hands of the army.

Under his brother, Gotabaya was defence secretary and effectively ran the security forces, allegedly overseeing "death squads" that bumped off rivals, journalists and others. He denies the allegations.

This makes the brothers detested and feared among many Tamils, who make up 15 percent of the population. Some in the Muslim community -- who make up 10 percent -- are also fearful of Gotabaya, having faced days of mob violence in the wake of the April attacks.

Under Mahinda, Sri Lanka also borrowed heavily from China for infrastructure projects and even allowed two Chinese submarines to dock in Colombo in 2014, alarming Western countries as well as India.

Prime Minister Narendra Modi tweeted on Sunday that India looked forward to "deepening the close and fraternal ties... and for peace, prosperity as well as security in our region".

The projects ballooned Sri Lanka's debts and many turned into white elephants -- such as an airport in the south devoid of airlines -- mired in corruption allegations.

Unlike in 2015 when there were bomb attacks and shootings, this election was relatively peaceful by the standards of Sri Lanka's fiery politics.

The only major incident was on Saturday when gunmen fired at two vehicles in a convoy of at least 100 buses taking Muslim voters to cast ballots. Two people were injured.

According to the Election Commission the contest was, however, the worst ever for hate speech and misinformation.