Sri Lanka's new government will investigate a reported attempt by Mahinda Rajapaksa to stay in power after it became clear he had lost last week's presidential election, according to a spokesperson.

"People think it was a peaceful transition. It was anything but," spokesman Mangala Samaraweera said on Sunday.

Rajapaksa stepped down only when the "army chief and the police inspector-general refused to go along with him". the AFP news agency quoted Samaraweera as saying.

Rajapaksa had been widely praised for conceding defeat early on Friday, even before the last votes in Thursday's election had been counted, when he realised that his rival Maithripala Sirisena had an unassailable lead.

Sri Lankans speak of hopes for the feature

But Samaraweera said that the 69-year-old, who had ruled the country since 2005, tried his best to annul the poll and cling to power.

He said police Inspector General N K Illangakoon was "very vocal and did not want to be a party to this".

Army chief Daya Ratnayake stood by the police and refused to deploy troops for Rajapaksa to seize power, while the state attorney general's department warned of dangerous consequences, the spokesman said.

Rajapaksa planned to stop the vote count as it became apparent that he was headed for a shock defeat and wanted to remain in office by issuing a proclamation declaring himself the president, Samaraweera said.

CA Chandraprema, a political analyst speaking to Al Jazeera from Colombo, dismissed the allegations as "absolute nonsense".

"He never did anything of that sort," he said, adding that the claims made by the government spokesperson was just one of several rumours being circulated by people within the winning coalition.