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 government is beset with cronyism. “Corruption has reached astronomical levels,” he said. Huge new infrastructure projects, including a new airport, seaport and cricket stadium in Rajapaksa’s native Hambantota district, have yielded little benefit, Wijesinha said. “When you really start to look at these nonperforming multimillion-dollar projects, you start to think, ‘Why were they built?’ You start to question the rationale behind spending such colossal amounts.”

Government members have refuted corruption allegations as just hot air and lacking any proof. “What they refer to now has no ground, and it looks like it is simply said because of the lack of any other campaign slogan,” Namal Rajapaksa recently told an interviewer.

Mahinda Rajapaksa’s victory over the LTTE, an armed group that sought a Tamil homeland in Sri Lanka during 26 years of civil war, once gave him unquestioned support among ethnic Sinhalese, who make up 70 percent of Sri Lanka’s 15 million voters. Their disillusionment is the key to this election.

Nirmala Fernando, 43, from the capital, Colombo, has voted for Rajapaksa since 2005. “I supported the president when he was fighting to keep the country safe,” she said. “But after 2010, he has forgotten the people, the people’s needs. He has allowed himself to be misled by those around him to spend on unnecessary things like airports and cricket grounds. He should have been much more thoughtful about the people.”

Sirisena has not promised to cut Sri Lanka’s massive spending on defense, but leaders from Tamil parties, who want more autonomy for Tamil-majority regions, say they hope he will negotiate with them in good faith. One major sticking point is the governorship of the Tamil-minority Northern province. TNA representatives have pushed to have a civil servant chosen by consensus, but Rajapaksa has kept in place an appointed retired military officer.

Sri Lanka does not have widespread opinion polling, so the outcome of the election is far from clear. Two surveys conducted in late December by the University of Colombo and the University of Kelaniya predicted victory for Sirisena and Rajapaksa, respectively, by the same margin, 53 percent of those polled.

Mahinda Rajapaksa and his entourage are campaigning furiously. Namal Rajapaksa invited his friend Salman Khan, an Indian actor, to add a touch of Bollywood to a recent event in downtown Colombo. Mahinda Rajapaksa had planned to hold a public audience in the capital to be broadcast live a day before the polls, until a court ordered TV stations not to air the program. Meanwhile, one of his ministers, Dallas Alahapperuma, asserted that Sirisena’s revolt must be backed by some foreign country. “International agents have pumped money into this country to destabilize this government,” he said. “How can parties like the JHU and the TNA, which criticized each other not so long ago, now appear on the same stage?”

Sirisena’s supporters say that his campaign has not received any foreign funds and that a recent surge in campaign funding has come from local businessmen who have traditionally supported the main opposition party.

If Rajapaksa loses on Jan. 8, there is some concern among the opposition that he will not go quietly after nearly 10 years in power. While Sri Lanka has never had a military coup and had mostly free elections even during the height of the civil war, Sirisena supporters worry that the president might dissolve parliament or try to use the army to hold on to power. But Rajapaka has said publicly that if he loses, he does not intend to cling to power.

A more immediate fear is election violence. In the last five days of campaigning, three rallies addressed by Sirisena have come under attack, including an incident in Kahawatte, in central Sri Lanka, in which three opposition supporters were injured when shots were fired at them on Jan. 5, the last day of campaigning. Keerthi Tennakoon, executive director of the Center for Free and Fair Elections (CaFFE), an independent election monitoring group, said that toward the end of the six-week campaign, attacks seemed to be concentrated in areas visited by Sirisena.

Tennakoon warned that in a tight contest, voter intimidation could decisively tip the scale. “Everywhere we go we hear one refrain — if it is a clean contest, it will be a close contest.”