COLOMBO, Sri Lanka — Sri Lanka's new government will investigate an alleged attempt by former President Mahinda Rajapaksa to stage a coup to try to stay in power when results showed he was losing last week's election, a spokesman for the country's new leader said Sunday.

A "special investigation" will be set up to probe the alleged coup soon after the new government is formed, said Mangala Samaraweera, the spokesman for President Maithripala Sirisena, who came to power after winning Thursday's election.

"Some say this was a very peaceful transition. But that's not the truth. People should know what happened behind the scenes," Samaraweera told reporters.

Until a few weeks ago, Rajapaksa was widely expected to easily win his third term in office. But Sirisena — his former friend and health minister — defected from the ruling party in November, and gathered the support of other defecting lawmakers, opposition parties and many of Sri Lanka's ethnic minorities, making the election a fierce political battle. Sirisena contested as the combined opposition candidate.

After conceding defeat, Rajapaksa left his office and the official presidential residence on Friday, saying he respected the people's mandate.

Samaraweera, however, said Sunday that Rajapaksa had made an attempt to deploy the army and police to stop the counting of votes when initial results showed he was heading for defeat.

He said Rajapaksa convened the chiefs of the police and the army, as well as the attorney general, at midnight Thursday and asked them to come up with a plan to stop the vote counting. Samaraweera said the three officials opposed the move.

Rajapaksa's media secretary, Wijayananda Herat, rejected the accusation, saying Rajapaksa convened the police and army chiefs only to instruct them to enhance the country's security.

Samaraweera said the new government's first task would be "to probe this coup and reveal to the country what really took place."

"People should know about the dangerous situation that existed and Rajapaksa's coup to bury the country's democracy," he said.

Sirisena assumed his duties on Friday and the new government is expected to be formed on Monday, a day before Pope Francis arrives in the island nation for a much-anticipated visit.

Separately on Sunday, Sirisena invited lawmakers from all political parties in the 225-member Parliament to join hands to form an all-party government to work for the country's development and to "restore good governance and protect the rule of law."

In his first address to the nation since the election, Sirisena said his main tasks would be to reduce the cost of living and scrap unlimited presidential powers, and pass some of the powers to Parliament, the Cabinet, the judiciary and independent commissions.

Rajapaksa was highly criticized for changing the constitution to scrap a two-term presidential limit and expand executive powers, allowing him to fill the judiciary and other offices with his appointees.

Sirisena refrained Sunday from speaking about a solution to the country's ethnic issues, which were the cause of a quarter century civil war that ended in 2009 when government troops defeated the Tamil Tiger rebels, who were fighting to create a separate state for ethnic minority Tamils.

Rajapaksa used the popularity he gained from winning the war to win a second term as president and a majority in Parliament.

Both Rajapaksa and Sirisena are members of Sri Lanka's majority Sinhalese population.