Colombo, Sri Lanka (CNN) -- Soldiers surrounded the Colombo hotel where Sri Lanka's opposition leader was staying Wednesday, hours after President Mahinda Rajapaksa was declared the winner of the country's first peacetime election in more than two decades.
Rajapaksa's opponent, Gen. Sarath Fonseka, said he did not accept the results of the election and is contesting the result.
There was "obvious rigging," Fonseka said from his hotel.
Official results broadcast on television Wednesday gave Rajapaksa a clear victory over his rival. Elections Commissioner Dayananda Dissanayake said the incumbent garnered 57.88 percent of the votes, with Fonseka receiving 40.15 percent.
The government said the presence of the soldiers and commandos, some of whom had their faces covered, outside the Cinnamon Lakeside Hotel was a precaution.
They did not intend to take Fonseka into custody, but were looking for army deserters who were holed up inside, the government said.
Fonseka said he was not leaving the hotel. He accused Rajapaksa of intimidation and said his staff had received threatening phone calls.
What will Sri Lankan election mean?
"He's ignoring the constitution to remain in power," Fonseka said of ally-turned-rival Rajapaksa.
The presidential election is the first since government forces put down a 26-year insurgency by Tamil Tiger rebels.
On Tuesday, top politicians vowed to block Fonseka from taking office if he won, because he is not eligible to vote.
The government will challenge the commissioner of elections in the Supreme Court on the issue of Fonseka's eligibility, Foreign Minister Rohita Bogollagama said.
Fonseka acknowledges that he is not registered to vote; 14 million Sri Lankans are eligible.
Rajapaksa and Fonseka have waged a bitter battle against each other in their campaigns.
Fonseka broke ranks with the Rajapaksa administration after he was elevated to the largely ceremonial post of chief of defense staff in July, following his retirement as army commander.
The general is riding a wave of popularity after he led a military campaign to crush Sri Lanka's Liberation Tigers of Tamil Eelam, also known as the Tamil Tigers.
After Fonseka announced his presidential bid, the main opposition parties -- with widely diverse political ideologies -- closed ranks and made him their common candidate.
The Tamil Tigers fought a brutal war for decades against the government and controlled large swathes of territory at the height of their power.
Rajapaksa also claims war-hero status with the win against the Tamil Tigers last May.
He is seeking a fresh mandate for his government, advocating for more development programs and jobs.
CNN's Sara Sidner and Iqbal Athas contributed to this report.