"People think it was a peaceful transition. It was anything but," spokesman Mangala Samaraweera told reporters. "The first thing the new cabinet will investigate is the coup and conspiracy by president Rajapaksa.
"He stepped down only when the army chief and the police Inspector General refused to go along with him."
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.
But Samaraweera said that the 69-year-old, who had ruled the country since 2005, tried his best to annul the poll and cling onto power.
He said police Inspector General N. K. Illangakoon was "very vocal and did not want to be a party to this coup".
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.
"Some world leaders have also spoken with president Rajapaksa and prevailed on him to ensure a peaceful transition," Samaraweera said. "I don't know who had spoken, but we known some leaders did talk to him."