COLOMBO, Sri Lanka — On Dec. 30, Sri Lankan President Mahinda Rajapaksa held a small meeting with dozens of astrologers, among them a few of his closest advisers — astrologers whom he consults to pinpoint auspicious times for everything from the opening of a new office to the signing of his nomination papers for the presidential election on Jan. 8. The race is turning out to be unexpectedly close, but in public, the astrologers have been all good news. Sumanadasa Abeygunawardena, his chief astrologer, predicted that Rajapaksa "will win a big victory."

Privately, they're worried about losing their jobs. One of the president's astrologers called a friend before the meeting, asking, "So what do you think will happen? Will we have to go home?"

Just a few months ago, when he looked all but invincible, no one would have predicted a close race. Rajapaksa, who led Sri Lanka through its brutal victory over the Liberation Tigers of Tamil Eelam (LTTE) in 2009, coasted to victory in the 2010 presidential election with 58 percent of the vote, and by September of that year his party had two-thirds majority in Parliament. Figuring he would capitalize on his popularity, Rajapaksa signaled several months ago that he would call an early election, dismissing the possibility of a real challenge. "I am not bothered about presidential elections," he said at a meeting with journalists in August. "I am planning for the next five years and beyond."

Rajapaksa assumed that his rival would either be Ranil Wickremesinghe, whom he defeated in 2005, or ex-President Chandrika Kumaratunga, a former party senior whom he outmaneuvered in 2005. Instead, he is facing a mass defection from his own party, led by Maithripala Sirisena, a man who had been a close ally for more than 40 years and less than two months ago was general secretary of Rajapaksa's Sri Lanka Freedom Party (SLFP).

Sirisena is campaigning on a growing disillusionment with what many Sri Lankans see as Rajapaksa's attempts to turn the country's once lively democratic politics into little more than a family business. Three of Rajapaksa's brothers hold positions in the government, and his eldest son, Namal Rajapaksa, is an MP. In 2010, Mahinda Rajapaksa pushed through an amendment to the constitution that ended term limits for the presidency, allowing him to seek a third term — a move that was widely seen as an attempt to hold on to power until Namal Rajapaksa, 25, was ready to take over. Some loyalists had taken to calling Mahinda Rajapaksa maharaja, or great king. "Maybe he thought he could be a real king," Sirisena said.

Like Mahinda Rajapaksa, Sirisena is a son of the soil, from a prosperous family of rice farmers in Polonnaruwa, the fertile northeastern region that is home to the 11th century ruins of an ancient city. One of his 11 brothers owns one of Sri Lanka's largest rice milling companies. A career politician since the 1970s, Sirisena has never had much of a national profile, but over the last few weeks, he has drawn significant support far from his base in the northeast. A rally in the southern port city of Galle on Jan. 5 drew 10,000 people.

Sirisena has put together a motley collection of parties united in their discontent with Rajapaksa, from the ultranationalist Buddhists of the Jathika Hela Urumya (JHU); to the coalition representing the minority Tamils, the Tamil National Alliance (TNA); and key former government allies among Muslim parties. By the latest count, the number of defections from Rajapaksa's government stood at 26 MPs and hundreds of provincial and local politicians.

Rajapaksa is getting a taste of his own medicine. In 2010 he put together his formidable majority by picking off defectors from the main opposition party. Now he is the one watching former friends cross the aisle. Some were once part of his inner circle, including Rajiva Wijesinha, a hard-liner who held sensitive positions during the last months of the civil war, including adviser to the president on human rights and head of the government's Peace Secretariat. When Rajapaksa faced intense international criticism for allegations of horrific abuses by the army against the LTTE, Wijesinha was his most reliable attack dog, appearing on the BBC's "Hard Talk," among other venues, to defend him.

While he still backs the government's conduct during the war, Wijesinha told Al Jazeera that he believes the Rajapaksa