(Adds details, analyst comment) By Lindsay Beck BEIJING, Feb 2 (Reuters) - China's security chief has warned judicial departments to stand firm in face of what he described as "hostile forces" of reform, but also urged the judiciary to improve its handling of social unrest. In a wide-ranging essay published in Seeking Truth, the Communist Party's leading journal, Luo Gan dampened reformists' hopes for moves toward an independent judiciary and reaffirmed the party's guiding role in law enforcement. "Hostile forces have been trying their best to attack and fundamentally transform our judicial system," Luo wrote in the essay seen on Friday. "All law enforcement activities should be led by the party. All reform measures should be conducive to the socialist system and the strengthening of the party leadership," wrote Luo, one of the nine-member Politburo Standing Committee that rules China. But Luo also displayed sensitivity toward social unrest -- fuelled by corruption, illegal land grabs and a rising gap between rich and poor -- that has challenged the party's efforts to maintain stability and its own grip on power. In some protests, participants had no direct interest in the cause but were venting accumulated anger, he said, adding that judicial departments should "reflect on this phenomenon" and "safeguard social justice and fairness". Analysts said the essay was an acknowledgement of the need for a more nuanced approach to addressing unrest beyond simply cracking down. "There is implicit recognition that repression doesn't seem to be demobilising protesters," said Nicholas Bequelin, a Hong Kong-based researcher for Human Rights Watch. "Mass incidents" across China's vast countryside fell in 2006 to about 23,000 from 26,000 in 2005, but Luo said the leadership could not afford to be complacent. "In handling mass incidents, we should not be satisfied with the fact they are subsiding, but rather we should work to pacify the feelings of the masses," he wrote. The chief prosecutor's office also issued a notice saying that, in cases of mass incidents, only the "tiny minority" should be punished in order to help ease social conflicts, the Beijing News reported. But Luo stuck to the need to "harshly punish" serious crimes, including those committed in the reform of state-owned enterprises and land sales, key areas for corruption. He said China's system of re-education through labour -- which targets political activists, along with petty criminals -- should be advanced, not scrapped as human rights groups have been urging. His essay also displayed a sensitivity to China's growing profile internationally, which will increase as the 2008 Olympics in Beijing approach. "In resolving domestic problems that might have international repercussions, we should consider the international impact and reaction and respond appropriately to the concerns of the international community," he said. At the same time, Luo expressed concerns about China's increasing exposure to outside influences. Non-governmental organisations should be closely monitored and service providers held more accountable to prevent dissemination of "harmful information" on the Internet or through text messaging, he wrote. (Additional reporting by Guo Shipeng and Chris Buckley)