Mahinda Rajapaksa, the incumbent Sri Lankan president, has been re-elected, the election commission says.
The elections commissioner said on Wednesday that Rajapakse had secured 57.9 per cent of the vote, while his rival, Sarath Fonseka, won 40.1 per cent.
Following his re-election the president said he wanted to repair relations with Western nations that criticised his government over its human rights record.
Rajapakse said most of the "misunderstandings" stemmed from the island's conflict with separatist Tamil Tiger fighters, but the matter was now over.
He said Sri Lanka was ready to address any concerns of "foreign friends" after its security forces were criticised during last year's offensive.
The UN said that up to 7,000 civilians may have died during the final stages of the civil war.
The election announcement came as troops were already surrounding the Cinnamon Lakeside hotel in the capital Colombo, where Fonseka, the former army chief, was staying along with some of his supporters.
Fonseka told reporters that the government was plotting to have him killed by removing his personal security guards and exposing him to assassination.
"They are behaving like murderers," he said.
"We will never accept this result. We will petition (the court) against it."
Mano Ganeshan, Fonseka's spokesman, said he wanted foreign protection.
"I am going to meet a diplomat of a neighbouring country to seek assurances of the safety of Sarath Fonseka," Mano Ganeshan said in an apparent reference to India.
Sri Lankan troops had surrounded Fonseka's hotel since the morning, with the government saying that the move had been taken for the former army chief's own protection.
Mike Hanna, Al Jazeera's correspondent, reporting from close to the Cinnamon Lakeside hotel, said that the neighbourhood had effectively become a military area.
"There are hundreds of troops on the street outside the hotel. There are blockades by buses in the roads leading to the hotel," he said.
"To come through we had to go through the cordon of the troops, a search by the troops of our vehicle - certainly its a very, very intense military presence outside the hotel where Sarath Fonseka and his entourage are staying."
Brigadier Udaya Nanayakkara, the Sri Lankan military spokesman, said the troops had been deployed following information that army deserters were among about 400 people inside the hotel.
"We don't know what's their motive and as a protective measure, we have deployed troops around the hotel and people who go in and come out are being checked," he was quoted by the Associated Press news agency as saying.
In the final days of the campaign, Fonseka had said the government harboured plans to either steal the vote or arrest him should he win.
Government allies, for their part, suggested that Fonseka's supporters might take to the streets, or that he might try to engineer a coup with his own loyalists in the army if he lost the vote.
Both sides have rejected the other's allegations and the election, which took place on Tuesday, was largely peaceful.
Susan Hayward, a Sri Lanka analyst at the US Institute for Peace, told Al Jazeera that there had been reports of some irregularities.
|Fonseka's supporters say he was too busy fighting a war to register as a voter [Reuters]
"The Centre for Monitoring Election Violence has given some reports of rigging," she said.
Some people have questioned the results of postal votes, which showed Rajapaksa with a slight lead, she said.
Meanwhile, Fonseka has found himself in the embarrassing position of having to state that he "may have voted".
He did not want to say clearly on Tuesday if he had, citing "security reasons".
Fonseka later admitted he was not on the country's voter rolls.
His supporters said he was too busy leading the war with the Tamil Tigers in 2008 when registration for the elections closed.
The government announced after polls closed that it would seek court action to disqualify Fonseka from the race.
However, the country's electoral commissioner later issued a statement saying his status on the voter rolls was irrelevant to his candidacy.