An Indian foreign ministry spokesman denied any expulsion and said that transfers were routine decisions. Rajapaksa, voted out of office in the Jan 8 election, told Reuters he did not know all the facts while the new government in Colombo has said it is aware of the reports but cannot confirm them.
But several sources in both Colombo and New Delhi said India was asked to recall the agent in December for helping gather support for joint opposition candidate Maithripala Sirisena after persuading him to ditch Rajapaksa's cabinet.
A sketchy report in Sri Lanka's Sunday Times newspaper on December 28 said that "links with the common opposition" had cost India's Research and Analysis Wing (RAW) station chief his job in Colombo.
India has often been involved in the internal politics of the small island nation off its southern coast - it sent troops there in 1987 in a botched effort to broker peace between the government and Tamil Tiger rebels.
Rajapaksa's unexpected defeat after two terms in office coincided with growing concern in India that it was losing influence in Sri Lanka because of the former president's tilt toward regional rival China.
The concern turned to alarm late last year when Rajapaksa allowed two Chinese submarines to dock in Sri Lanka without warning New Delhi as he should have under a standing agreement, the sources said.
Sirisena, the new president, has said he will visit New Delhi on his first foreign trip next month and has said India is the "first, main concern" of his foreign policy.
An Indian official said the RAW agent was recalled after complaints that he had worked with Sri Lanka's usually fractious opposition parties to agree on a joint contender for the election. Then, he was accused of facilitating meetings to encourage several lawmakers, among them Sirisena, to defect from Rajapaksa's party, the official said.
The agent was accused of playing a role in convincing the main leader of the opposition and former prime minister Ranil Wickremasinghe not to contest against Rajapaksa in the election and stand aside for someone who could be sure of winning, said the officer and a Sri Lankan lawmaker who also maintains close contacts with India.
The agent was also in touch with former president Chandrika Kumaratunga, who was a key player in convincing Sirisena to stand, said the officer and the lawmaker, who also confirmed that the agent had been asked to leave.
"They actively were involved, talking to Ranil, getting those things organised, talking to Chandrika," the lawmaker told Reuters.
"CERTAIN THINGS YOU DON'T TALK ABOUT"
Wickremasinghe, who is now prime minister again in Sirisena's government, met "two or three times" with the man identified as the agent in the months before the vote, as well as with the Indian high commissioner, or ambassador, the prime minister's spokesman said.
"They discussed the current political situation," Wickremasinghe's spokesman said, but he denied that the Indians had advised him. "He does not know if he advised other politicians."It was not clear if Wickremasinghe was aware at the time that he was meeting with an intelligence official. India's RAW officers are usually given diplomatic posts when assigned to foreign missions.
Former president Kumaratunga did not respond to requests for comment.
Rajapaksa declined to confirm the involvement of India in the campaign against him.
"I don't know, I won't suspect anybody until I get my real facts," he said at his party headquarters.
"There are certain things you don't talk about," a close associate of the Rajapaksa family said, but added that "there were clear signs of a deep campaign by foreign elements."
Sri Lanka's then defence secretary Gotabaya Rajapaksa - a brother of the former president - complained about the agent's activities to Indian National Security Adviser Ajit Doval in November when Doval was visiting the island nation for a defence seminar, the Indian official said.
Another Indian official, who monitors the region for security threats, said New Delhi had been watching Beijing's growing influence and heavy investments in Sri Lanka under Rajapaksa, who visited China seven times since becoming president in 2005.
But India was stunned and angry last year when the Chinese submarines docked in Sri Lanka on two separate occasions, a step New Delhi saw as part of Beijing's "string of pearls" strategy to secure a foothold in South Asia and maritime access through the Indian Ocean.
"The turning point in the relationship was the submarines. There was real anger," the Indian security official said.
Indian military officials said that New Delhi reminded Sri Lanka it was obliged to inform its neighbours about such port calls under a maritime pact, and Indian Prime Minister Narendra Modi raised the issue with Rajapaksa at a meeting in New York.
In a possible sign of shifting allegiances, India's top envoy in Colombo, High Commissioner Y.K. Sinha, presented Sirisena with a large bouquet of flowers just hours after the results were announced on Jan 9. China's ambassador was only able to meet the new president six days later.
(Additional reporting by Frank Jack Daniel; Editing by Raju Gopalakrishnan)